Skip to main content
Solved

How to define a parameter using another parameter?

  • July 10, 2017
  • 4 replies
  • 30 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.

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
Influencer
Forum|alt.badge.img+46
  • Influencer
  • July 10, 2017

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


Forum|alt.badge.img
  • Best Answer
  • July 10, 2017

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
  • July 11, 2017

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
  • July 11, 2017

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).