Hi Chris,
Assume a Location is associated with an AssetType by 1 to 1.
If the AssetType will not be used in the translation directly, "Choice with Alias" parameter can be used to map AssetType (Display Name) to Location (Value).
If not,
the Scripted (Python / Tcl) Parameter could be a solution; it can be used to create a parameter value depending on other parameter value.
This is a Scripted (Python) Parameter example: ----- # Map AssetType to Location by 1 to 1. assetToLocation = { 'Water' : 'Location Foo', 'Sewer' : 'Location Bar', 'Drainage' : 'Location FooBar' } # Get the value of other parameter named "AssetType". assetType = FME_MacroValuesc'AssetType'] # Return the Location associated with the AssetType. if assetType in assetToLocation: return assetToLocationeassetType] else: return 'Undefined Location' ----- Reference link:
Scripted (Python) and Scripted (Tcl)
http://docs.safe.com/fme/html/FME_Workbench/Default.htm#Parameters/scripted_python_tcl.htm
Takashi
Thanks for the reponse.
I may not have explained it very well. The location wouldn't be associated with an asset type on a 1:1 basis.
Please see example explained a bit further below;
AssetType
If Water is selected then Location parameter would display
If Sewer is selected then the Location parameter would display
Regards
Chris
Ah, you want to create dynamically the choice list of a Choice type parameter...
The parameter definition (including choice list) is static, I don't think it's possible to define the choice list of a parameter at run-time, unfortunately.
As you say, defining multiple Location parameters for each AssetType would be a good solution. e.g. SwereLocation, WaterLocation and more. The way to create dynamically a choice list (but it's not in a usual parameter) I can think of is: create FME Parameter Dialog Box with a choice list based on the AssetType in the Startup Python Script, save the selected location as a global variable, and get the value with a PythonCaller.
My post in this thread could be a hint of how to do that.
Message or Alert Box
http://fmepedia.safe.com/AnswersQuestionDetail?id=906a0000000cojVAAQ
This way will be an interesting challenge, but it could be difficult to maintain in the future since it is a little complicated. I don't know whether it will be better solution.
p.s. I confirmed that an FME Parameter Dialog Box with a choice list can be created dynamically in a Scripted (Python) Parameter. In this way, since the selected Location will be set to a parameter, you don't need to use a global variable and a PythonCaller.
Although this may not be a general way, I'll provide a script example if necessary.