Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
SJeshwani1618330394
Contributor
Contributor

How to pass the context variable from command line

Hi,

I am scheduling a flow every month using the following URL:

https://services5.arcgis.com/sjP4Ugu5s0dZWLjd/arcgis/rest/services/Bands_Public/FeatureServer/0/quer...

'"+ TalendDate.addDate( TalendDate.getDate("YYYYMMDD"), "yyyyMMdd", -1, "MM" )+"'AND%20STARTDATE%20%3C='"+ TalendDate.addDate(TalendDate.getDate("YYYYMMDD"), "yyyyMMdd", -1, "dd")+"'&returnGeometry=true&resultType=standard&outFields=*&outSR=4326&f=json

I have passed the URL as a variable from context variable -> tJava -> tHttpRequest. It's working as expected.

But I want to change the URL by passing the context param from command line, however I am unable to override it.

Regards,

sheetal

Labels (2)
4 Replies
Anonymous
Not applicable

Hi

Below is the syntax of passing new values to context variables from command line.

>jobName_0_1.bat --context=Default --context_param var1=value1 --context_param var2=value2

 

Please try and let me know if you have any issues.

 

Regards

Shong

 

 

SJeshwani1618330394
Contributor
Contributor
Author

Hi Shong,

 

Thank you for your reply.

 

I tried the syntax you provided but still, I am unable to override the value while running the job from command line.

 

job.bandsdatamonthlyflow_0_1.BandsDataMonthlyflow --context=Default --context_param BandsMonthlyURL=https://services5.arcgis.com/sjP4Ugu5s0dZWLjd/arcgis/rest/services/Bands_Public/FeatureServer/0/query?where=STARTDATE%20%3E='"+ TalendDate.addDate( TalendDate.getDate("YYYYMMDD"), "yyyyMMdd", -3, "MM" )+"'AND%20STARTDATE%20%3C='"+ TalendDate.addDate( TalendDate.getDate("YYYYMMDD"), "yyyyMMdd", -1, "dd" )+"'&returnGeometry=true&resultType=standard&outFields=*&outSR=4326&f=json"$@"

 

Regards,

Sheetal

joeg627
Contributor
Contributor

Thank you @Shicong Hong​ , this is very helpful!

joeg627
Contributor
Contributor

@Sheetal Jeshwani​ IMO you are passing in too much, and I doubt the TalendDate operations will work when passed in from command line. You might consider having 2 context variables for start date and end date that are used in another context variable for the URL. So in your context, you'd have a variable for BandsMonthlyURL with a value like

 

```https://services5.arcgis.com/sjP4Ugu5s0dZWLjd/arcgis/rest/services/Bands_Public/FeatureServer/0/quer...'"+ TalendDate.addDate( TalendDate.getDate("YYYYMMDD"), "yyyyMMdd", context.StartDate, "MM" )+"'AND%20STARTDATE%20%3C='"+ TalendDate.addDate( TalendDate.getDate("YYYYMMDD"), "yyyyMMdd", context.EndDate, "dd" )+"'&returnGeometry=true&resultType=standard&outFields=*&outSR=4326&f=json"$@" ```

 

Then from the command line you could pass in just --context=Default --context_param StartDate=-3 --context_param EndDate=-1