Thu Aug 16, 2018 6:51 am
Login Register Lost Password? Contact Us

Converting a string into a field reference for a macro

Comments and questions related to the Enterprise Control Language

Fri Oct 27, 2017 7:53 pm Change Time Zone

I need to create a function that can take input parameters, pass them to any given function or functionmacro, shape the output of the functionmacro and return it.

I have no control over the functions & macros I'm passing data to, but do have full control over the content of the function.

My problem is this: if the macro I'm passing data to has a "field" type input, I need a way to convert the "string" parameter passed into the function by a user to a field to pass into a macro. Usually I could use #EXPAND() to do this, but because this is a function, a "constant value required" error is returned.

I tried adding in a MAP to the function, e.g. fieldtouse:=MAP(val='xxx'=>dsin.field1, val='xx2'=>dsin.field2) to get a concrete field to pass into the macro. Unfortuntely if the fields coming back out of the map are of different datatypes this fails.

Basically, I have a situation where I am in a function, have a string value, and have to get it into a macro as a field value. I can't change the fact that I'm in a function, that the input parameter is a string, or the content of the macro. Am I hosed? Or is there some clever trick to manage this?
Posts: 34
Joined: Tue Nov 19, 2013 6:42 pm

Fri Oct 27, 2017 8:43 pm Change Time Zone

Am I hosed?
I think so, yes. :(
Or is there some clever trick to manage this?
The only way I've ever managed anything like this is to turn it into a two-step manual process:
  • The first step workunit generates a result that gets passed to the second step by a manual invocation (in the ECL IDE) of a "drilldown" on that result.
  • The "drilldown" launches a new WU, passing the previous WU's result as an XML string that ECL's Template Language then parses to generate ECL and run it to produce the desired result.
PM me if you want to see the actual code that does all that. :)


Community Advisory Board Member
Community Advisory Board Member
Posts: 1369
Joined: Wed Oct 26, 2011 7:40 pm

Return to ECL

Who is online

Users browsing this forum: No registered users and 1 guest