Skip to main content
Solved

How to define a parameter using another parameter?

  • Jul 10, 2017 4:59 PM UTC
  • 4 replies
  • 98 views

arthy
Contributor
Forum|alt.badge.img+8

Hi,

I would like to define a private parameter based on a publish parameter. My idea is to use a python script that should return the desired private parameter.

import fmeobjects
if (FME_MacroValues['publih_parameter'] == 'val'):
private_parameter='val_'
elif (FME_MacroValues['publih_parameter'] == 'wal'):
private_parameter='wal_'
else:
private_parameter='zal_'
return private_parameter

But this is not working. 

Any ideas?

Thanks

Best answer by larry

If it is not working, what kind of error message or unexpected behavior you are having?

The attached workspace (FME 2016) works correctly with a Scripted (Python ) parameter.

View original
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

ebygomm
Evangelist
Forum|alt.badge.img+54
  • Evangelist
  • Jul 10, 2017 5:26 PM UTC

Is there a reason you don't want to just use a choice with alias?


Forum|alt.badge.img
  • Best Answer
  • Jul 10, 2017 6:13 PM UTC

If it is not working, what kind of error message or unexpected behavior you are having?

The attached workspace (FME 2016) works correctly with a Scripted (Python ) parameter.


arthy
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • Jul 11, 2017 11:03 AM UTC

If it is not working, what kind of error message or unexpected behavior you are having?

The attached workspace (FME 2016) works correctly with a Scripted (Python ) parameter.

@larry,

 

realized that if I transform a choice parameter to a scripted python parameter, it fails and that was certainly my issue given that the code that I provided above is correct.

 


arthy
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • Jul 11, 2017 11:06 AM UTC

Is there a reason you don't want to just use a choice with alias?

The reason is simple.

 

I want to have only one published parameter and then all the other parameters being based on that published parameters. Too many choice parameters may induced some errors (when you forgot to select the good choice).