Skip to main content
Question

PythonCaller: expose attributes defined in published parameter

  • November 11, 2014
  • 4 replies
  • 43 views

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
I have a custom transformer that uses a python caller to create a list where the name of the list is a published parameter (listName).

 

 

Normally on the python caller I would set the expose attribute to myList{}.value

 

but in this case I thought it would be $(listName){}.value, however that syntax doesn't appear to work.

 

 

Any suggestions?

 

 

4 replies

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • November 11, 2014
Hi,

 

 

$(PARAMETER_NAME) will be replaced with the parameter value simply.

 

What kind of error has occurred?

 

 

Takashi

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • November 11, 2014
Maybe I misunderstood. Your question probably is how to expose the list name specified by a published parameter.

 

 

Unfortunately the syntax seems to be invalid in the "Attributes to Expose" parameter of the PythonCaller. As far as I know, only possible way is:

 

1) In the script, create the list with a temporary name. e.g. _tmplist{}.value

 

2) Expose the temporary name using the "Attributes to Expose" parameter.

 

3) Rename it with a ListRenamer.

 

Type To Rename: List

 

List/Component Name: _tmplist

 

Replace With: $(listName)

 

 

Note:

 

In FME Workbench 2014, this method works fine as expected.

 

However, the ListRenamer will be updated in FME 2015. Much enhancements have been done for the new ListRenamer, but unfortunately user parameter cannot be set to the replacement name, at least in the latest beta.

 

And, in my testing, existing custom transformers which are using this method with the current ListRenamer do not show the list name properly, when I opened the workspace with FME Workbench 2015. It works fine functionally, but the default list name is always visible in the interface even if I set other name to the parameter. No good...

 

I've already asked Safe to resolve this issue several weeks ago, but it may not be resolved by first release of FME 2015.

 

I myself am going not to parameterize a list name until the issue has been resolved.

jdh
Contributor
Forum|alt.badge.img+28
  • Author
  • Contributor
  • November 11, 2014
Hi Takashi,

 

 

Yes, my question is indeed how to expose the list name specified in the published parameter.  I've adopted your solution and put a note in about incompatibility with 2015.

 

 

Thanks.

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • November 13, 2014
I found another trick by chance in the implementation of the StringMultiSearcher (FME Store transformer). This screenshot illustrates the trick.

 

 

 

Transformers in the Bookmark expose list names specified by Published Parameters. ?They does nothing other than the exposing; actural list attributes will be created by the PythonCaller.

 

The upper stream in the Bookmark exposes a structured list - "$(listName1){}.sub1", "$(listName1){}.sub2"; the lower stream exposes a simple list - "$(listName2){}". The Aggregator is the key.

 

This method worked fine in both FME 2014 SP4 build 14433 and 2015 Beta build 15210.

 

See also the implementation of the StringMutliSearcher.

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings