There are two ways to do what you want.
- Set the filter constraints and dollar amounts as configuration values, which can be accessed from your code in the various operators.
- Set the filter constraints and dollar amounts as persistent values, which can be accessed from your code in the various operators.
The better approach is option 2 as you will be able to change the constraints and amounts from a small script file or by issuing commands in an Expressor command window, rather than opening the project and making changes in a configuration artifact.
Look in the documentation for discussion of persistent values and the utility.store... and utility.retrieve... functions that are used to store and retrieve persistent values.
#2 worked like a champ. But #1 is a bit more finicky. To retrieve the value of the Parameter, I'm using:
Unfortunately, this only seems to work for values that Expressor allows you to parameterize (see attached screenshot). I've added 'my_parameter' to the list of Parameters in the Configuration Artifact (and set a value). But this:
...only returns 'nil'.
If I change it to:
...which is the Host Parameter in my Connection, it returns the correct value: "MSSQL1". So I'm guessing if I parameterize an Artifact or Operator value with 'my_parameter', then it'll work. 'Course, that defeats the purpose.
I'm not sure if it is something I'm doing, or if I'm just asking too much of Expressor. It'd be nice to have both options available for different scenarios. But I think Persistent Values could do by itself.
Yes, this is why I suggested #2 as the better approach.
That said, since your application was extracting other parameter values from the configuration artifact, my_Parameter should have been available to the expressor.NamedParameters.my_Parameter or expressor.NamedParameters['my_Parameter'] call.
This functionality within Expxressor is likely case sensitive, so be sure you refer to the value as my_Parameter (note the upper case P).
Hmmm... not sure what I'm doing wrong. I double-checked to make sure all the casings were consistent. I also tried changing the calls to: expressor.NamedParameters.my_Parameter
Still getting 'nil' on Parameters I manually added to the Configuration Artifact.
Not sure if it matters, I'm running version 3.9.1
Thanks for all your help!
We use the store/retrieve way of bringing in globals. We have a file that just contains name/value pairs:
Then our first executed dataflow has a step that reads this file and sends it to a Write Custom operator with this in the function:
log.information("Global: "..input.Name..": "..input.Value)
In dataflows that need a particular global, we would have this in some transform or other operator that is already in place:
factor = tointeger(utility.retrieve_string("OperatorTimeFactor"))
We also have places where we generate a global on the fly. So we do some processing and we keep track of the maximum value of some attribute data. In a finalize function in that transform, we use utility.store_integer (or whatever store function based on the datatype). Then in later steps or dataflows, we have the corresponding retrieve_integer to use in that transform.