Sat Aug 18, 2018 11:45 pm
Login Register Lost Password? Contact Us


How to pass parameters into ECL File

Comments and questions related to the Enterprise Control Language

Mon Sep 25, 2017 2:03 pm Change Time Zone

Dear Team,

Can you please assist me in finding way to pass parameters into ECL file.
Sample Code:
EXPORT Test(Integer val) := FUNCTION
shared layout := RECORD
String Name;
INTEGER AGE;
END;
OUTPUT(val) ;
ds := DATASET([{'a', 33}, {'b', 31}, {'c', 29}, {'d', 40}], layout);
return ds[val];
END;

How can i call it by passing some parameters?
abhayamishra
 
Posts: 6
Joined: Thu Sep 21, 2017 7:27 am

Tue Sep 26, 2017 5:31 pm Change Time Zone

abhayamishra,

That's the kind of basic question that is already covered in our free ECL online courses https://hpccsystems.com/training#Classes -- have you gone through them yet?

So, to execute your "test" function, you can just add a new ECL file to the same directory (module) your function in written to, and in that file type this:
Code: Select all
IMPORT $;
$.test(2); //2 is my test value, you can make that whatever you want
  //should return your second record  {'b', 31}
then hit the Submit button and your function will be used as your query.

HTH,

Richard
rtaylor
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1370
Joined: Wed Oct 26, 2011 7:40 pm

Wed Sep 27, 2017 6:23 am Change Time Zone

Hello Richard,

Let me rephrase my question.
How an ECL file can read input parameters/file from outside(not within ECL/HPCC env) running on THOR cluster?
Or How can i pass parameters(generated dynamically) to ECL file from outside of ECL/HPCC env?

For an Example,
I have to spray file to HPCC thor system. And that file path is not constant(directory is changing at runtime) or vary across all envs (dev, qc).
Then to spray file everytime from different filepaths, i have to pass file path at runtime.
How could it be done?
abhayamishra
 
Posts: 6
Joined: Thu Sep 21, 2017 7:27 am

Wed Sep 27, 2017 2:10 pm Change Time Zone

abhayamishra,
How an ECL file can read input parameters/file from outside(not within ECL/HPCC env) running on THOR cluster?
Or How can i pass parameters(generated dynamically) to ECL file from outside of ECL/HPCC env?
That question is also covered in our ECL online courses (the Roxie ECL courses). The short answer is: using SOAP and ECL's STORED workflow service.

Their use and interaction for this is also fully described in the section of Programmer's Guide articles titled Working With Roxie. The Programmer's Guide is availabe as a PDF download (https://hpccsystems.com/training/documentation/learning-ecl) and is also completely contained in the ECL IDE compiled Help file (press F1).

HTH,

Richard
rtaylor
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1370
Joined: Wed Oct 26, 2011 7:40 pm

Wed Oct 25, 2017 6:46 am Change Time Zone

Dear Richard,

Thankyou for help.

I am able to do it using stored variable. Mainly my concern was to doing using command line.
I used -X option for same. ecl run -Xparam=value

Thankyou
Abhay
abhayamishra
 
Posts: 6
Joined: Thu Sep 21, 2017 7:27 am


Return to ECL

Who is online

Users browsing this forum: No registered users and 1 guest

cron