Question

How to change published parameter value after run time

  • 30 June 2014
  • 4 replies
  • 36 views

Badge
I think this is simple.  I am running FME 2011.  I would like to change the value of a published parameter during a translation (i.e. overide what was set at run time).  Since i use a parameter fetcher in many locations of my workbench, i only want to change this in one location at the start of my translation based on a set of other criterial.

 

 

I tried to use an attribute setter set $(PublishedParameterName) = New Value however this did not work.

 

 

My workaround is to use variable setter / retriever however i would prefer not to do this.

 

 

Thanks in advance.

4 replies

Userlevel 2
Badge +17
Hi,

 

 

unfortunately parameters are read-only, their values cannot be changed anyhow at run-time. The VariableSetter/Retriever, as you mentioned, or a Python global variable could be a workaround.

 

 

Takashi
Badge
Alternatively you can use a scripted parameter to generate a value at startup based on a criteria. The drawback with this approach is that the criteria would need to be done inside the script and could not be based on elements in the workspace itself.

 

 

Example of scripted parameter
Badge
Hi,

 

 

unfortunately parameters are read-only, their values cannot be changed anyhow at run-time. The VariableSetter/Retriever, as you mentioned, or a Python global variable could be a workaround.

 

 

Takashi

I tried using a VariableSetter/Retriever (to/from a Parameter) but the value is blank on retrieval. I can't use an attribute as they're lost after a FeatureWriter is executed.

And while FeatureWriters have "Additional Summary Attributes" - the value of _featuretype{0}.VariableName is empty.

Userlevel 4
Badge +13

I tried using a VariableSetter/Retriever (to/from a Parameter) but the value is blank on retrieval. I can't use an attribute as they're lost after a FeatureWriter is executed.

And while FeatureWriters have "Additional Summary Attributes" - the value of _featuretype{0}.VariableName is empty.

Hi @peterx The VariableRetriever has likely been triggered before the variable was set with a VariableSetter. See https://knowledge.safe.com/questions/52322/variable-setter-and-retriever-foundations.html and https://knowledge.safe.com/questions/72246/variablesetter-and-variableretriever-run-order.html for more ideas. You also might want to try the VariableGetter custom transformer which has a port for features where the variable exists and one for where the variable hasn't been set.

Reply