How to pass a 'batch file with date parameters' to 'Execute Program' operator

SupriyaSupriya Member Posts: 2 Contributor I
edited November 2018 in Help

I have two 'context level'macros defined in my Rapid Miner process as - from_date = //some date//

to_date = // some date//

In my Rapid Miner process, i am using an 'Execute Program' operator. This operator should accept the two macros defined earlier. I am supplying below command in 'command' field of this operator

C:\test.bat %{from_date} %{to_date}

'test.bat' Windows batch file content -

C:\mongodb\bin\mongoexport --db db1--collection c1 --query "{'logentry.date': { '$lt': {'$date' : ISODate('%1')} , '$gte': {'$date': ISODate('%2') }}}" --out C:\test1.csv --type csv --fields id,name

'Execute Program' should perform action defined in the windows batch file (i.e. processing should be done and results are to be saved to the 'CSV' mentioned in batch file). But when i use the above command and run the Rapid Miner process, CSV is shown with blank content.

From command line, I am able to run the the 'test.bat' file with date parameters - as shown below

c:\MyTests>test.bat 2016-07-28T11:58:59.633069Z 2016-07-19T12:42:00.248412Z

after running the above command, successfully i can see the output in the CSV.

 

I want to know how we can pass a batch file with context macros as parameters to the command field in 'Execute Program' operator.

 

Correct me if my approach is wrong and please let me know a better to address this issue

 

Any help is greatly appreciated. Thanks !

Answers

  • bhupendra_patilbhupendra_patil Administrator, Employee, Member Posts: 168 RM Data Scientist

    I just tried with the followin command

     

    cmd /c start C:\"Program Files"\"Internet Explorer"\"iexplore.exe" %{url}

     

    where url is a context macro and it worked out fine, it would open the url i was passing in the context macro.

     

    Not sure if this helps but wanted to confirm that your syntax looks correct, something  else broken? 

  • SupriyaSupriya Member Posts: 2 Contributor I

    Thanks for you reply.

    When i run the process using the command i posted, blank csv is shown in the result.

    Expected outcome is a csv file with the 'id' and 'name' details.  

Sign In or Register to comment.