Question

VariableRetriever in Custom Transformers

  • 22 October 2014
  • 5 replies
  • 2 views

Badge +1
Hi,

 

 

I am using FME2014 and I have two custom transformers that are used in my workspace.  The first customer transformer that is used has inside it a VariableSetter which I set to a Global Variable.

 

 

In the second custom transformer I use VariableRetriever to retrieve the Global Variable.  But it doesn't seem to work.

 

 

Are you able to retrieve variables in CustomTransfomers?  Note: I have set both custom transformers's Attribute References Setting to: Advanced - Fix Manually

5 replies

Badge +3
Hi,

 

 

 

I do have Setter/retriever combo's.

 

 And yes you can do what you are doing.

 

 

..feel the but comming up yet?...

 

 

You're proces must be set up in such a way that when the Retriever is called, wherever it si, the called variable must be set already..:

 

 

SettIt is a variablesetter in a custom and ReadPara a vriablereader. Nothing else

 

 

In pic1 ReadPara2 succesfully retrieves the variable, but ReadPara does not.

 

 

 

 

In pic2 however both manage to retrieve it!

 

Reason is, i inserted a couple of processes slowing down the bottom stream.

 

 

 

so, yes u can or at least it is possible.
Badge +1
thanks Gio.  I understand that I need to make sure that I slow down the processes to ensure the variable in the other process gets there first.  However, I dont' understand why FeatureHolder doesn't slow things down enough without having to add in extra transformers to try and slow things.  Is there another transformer, so some sort of way of telling FME which process to do first so I don't need to try and slow things down which seems a bit cumbersome?

 

 
Badge +3
Hi,

 

 

Because the feature holder in the pick is not in the same stream, or does not use required elements used the SettIt.

 

 

I think if the holder holds elements required in SettIt, it might be enough. (though i didn't test this).

 

 

On the other...wait!.

 

Ok, this works too. Create a "Waiter".

 

 

 

 

 

The waiter Retrieves the variable you set (or are trying to set)

 

And then tests it. Until it ha "arrives" the Waiter loops.

 

I use Missing and Empty and not Null.

 

(but you adaept test to suit your requirements of course)

 

 

 

This works neatly :)

 

 

 

 
Badge +3
..a perk to this "waiter" technique is, that you can do compound testing to collect Variables of different streams all over the workspace.
Badge +1
yes I've tried the "waiter" and it does what i need!

Reply