Solved

VariableRetriever seemingly inconsistent behavior? Sometimes works and sometimes doesn't.


Badge

Depending on what sections of my FME workflow I run, the VariableRetriever returns with the expected value or returns empty. If I run with the large selection (in red), it does not work. If I run with the small selection (in blue), it does work. Can someone explain the VariableRetriever seemingly inconsistent behavior?

 

See attached screenshots for details.

 

 

icon

Best answer by dustin 13 December 2022, 17:42

View original

15 replies

Userlevel 4

Be aware that the VariableRetriever / VariableSetter transformers don't support partial runs using feature caching.

Userlevel 6
Badge +31

Using VariableSetters / VariableRetrievers combined with FeatureCaching does not work well for me.

I'm using FeatureMergers with a value "1" in the requestor and supplier when I need this stuff and want to use FeatureCaching, but not sure if that is the best alternative.

2022-12-13_16h15_48

Badge

Using VariableSetters / VariableRetrievers combined with FeatureCaching does not work well for me.

I'm using FeatureMergers with a value "1" in the requestor and supplier when I need this stuff and want to use FeatureCaching, but not sure if that is the best alternative.

2022-12-13_16h15_48

I am trying to develop an approach to eventually use on much more complex FME workflow and was hoping to not use connected merger like the FeatureMerger. I really liked the elegant approach of the VariableSetter/VariableRetriever which allowed me to pass a variable without having to connect transformers. Thanks for the proposition, I will consider it.

Badge

Be aware that the VariableRetriever / VariableSetter transformers don't support partial runs using feature caching.

I have the same problem when I run the whole workflow either with or without feature caching activated.

Userlevel 4

I have the same problem when I run the whole workflow either with or without feature caching activated.

In that case it might be a question of feature order, i.e. in which order the Setter and Retriever is triggered. Try setting breakpoints before each transformer and see what happens.

Userlevel 4

Using VariableSetters / VariableRetrievers combined with FeatureCaching does not work well for me.

I'm using FeatureMergers with a value "1" in the requestor and supplier when I need this stuff and want to use FeatureCaching, but not sure if that is the best alternative.

2022-12-13_16h15_48

I've just created an Idea for having the VariableSetter / VariableRetriever support feature caching, feel free to vote for visibility: https://community.safe.com/s/bridea/a0rDm000000CbI9IAK/variableretriever-variablesetter-should-play-nice-with-feature-caching

Badge

I've just created an Idea for having the VariableSetter / VariableRetriever support feature caching, feel free to vote for visibility: https://community.safe.com/s/bridea/a0rDm000000CbI9IAK/variableretriever-variablesetter-should-play-nice-with-feature-caching

Great idea!! Thanks.

Badge

I have the same problem when I run the whole workflow either with or without feature caching activated.

If you look at the workflow printscreen in the attached files, the setter is set before the retriever in a connected path. And also, the first retriever (the one straight up following the setter) works fine. But the second one (the one circled in green) does not. However, the two rerievers are configured exactly the same.

Userlevel 4

I have the same problem when I run the whole workflow either with or without feature caching activated.

Unless some of the input feature types in the blue rectangle ("idec...") arrive before the VariableSetter gets triggered?

Userlevel 3
Badge +26

Great answers thus far concerning VaribleSetter/VariableRetriever...

Looking at your use-case specifically, you could use the following code in a scripted parameter to return the current date, which could be called in the workspace using a ParameterFetcher (or directly in your other transformers)

from datetime import datetime
 
date_time=datetime.today().strftime('%Y%m%d')
 
return(date_time)

 

Badge +10

The other thing to be aware of is the setting that was introduced in I think 2020, where Feature Order is not always preserved across ports, which can also upset the Variable Setter/RetrieverimageFeatures from the reader will hit the variable retriever circled in green possibly before it is set which i suspect is the issue. If you add a featureholder before your testfilter that should fix the issue (I think)

Userlevel 4

Great answers thus far concerning VaribleSetter/VariableRetriever...

Looking at your use-case specifically, you could use the following code in a scripted parameter to return the current date, which could be called in the workspace using a ParameterFetcher (or directly in your other transformers)

from datetime import datetime
 
date_time=datetime.today().strftime('%Y%m%d')
 
return(date_time)

 

Agreed, this is exactly what I do. You may not even have to use the ParameterFetcher, in most cases.

Badge

Great answers thus far concerning VaribleSetter/VariableRetriever...

Looking at your use-case specifically, you could use the following code in a scripted parameter to return the current date, which could be called in the workspace using a ParameterFetcher (or directly in your other transformers)

from datetime import datetime
 
date_time=datetime.today().strftime('%Y%m%d')
 
return(date_time)

 

That works like a charm!! Super easy to implement with minimal transformers. Much thanks! 

I would have one question though : Let's say I run the script at 11:59PM, do you know if the parameter will update during the run or will it settle to the first value it got at the moment the script was executed ?

Userlevel 1
Badge +11

That works like a charm!! Super easy to implement with minimal transformers. Much thanks!

I would have one question though : Let's say I run the script at 11:59PM, do you know if the parameter will update during the run or will it settle to the first value it got at the moment the script was executed ?

The parameter is set before the translation runs; use a DateTimeStamper to reset the date during the translation.

Badge

That works like a charm!! Super easy to implement with minimal transformers. Much thanks!

I would have one question though : Let's say I run the script at 11:59PM, do you know if the parameter will update during the run or will it settle to the first value it got at the moment the script was executed ?

Perfect! I need that date value to be fixed.

Reply