Skip to main content
Question

How to dynamically populate in a published parameter based on the output of an attribute column?

  • January 26, 2023
  • 8 replies
  • 226 views

joy
Enthusiast
Forum|alt.badge.img+15
  • Enthusiast

Hello everyone,

I have a column with output that changes depending on different input.

Ideally, I would like to populate a published parameter (Choice) based on the output of that column, so then a user can click on a value of that choice list on FME Server in let's say a workspace app.

Does anyone know how to dynamically fill in a choice list based on the output of a column?

afbeelding 

8 replies

dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • January 26, 2023

It's not possible in a single workspace since parameter values are established at runtime, meaning they can't be retroactively published after you click Run. I haven't personally tried but this article outlines a similar process to what you are describing using a two step process. EasyGeocoder - Data Driven Self-Serve Data Transformation (safe.com)


joy
Enthusiast
Forum|alt.badge.img+15
  • Author
  • Enthusiast
  • January 27, 2023
dustin wrote:

It's not possible in a single workspace since parameter values are established at runtime, meaning they can't be retroactively published after you click Run. I haven't personally tried but this article outlines a similar process to what you are describing using a two step process. EasyGeocoder - Data Driven Self-Serve Data Transformation (safe.com)

I tried another method based on the following article and I am getting quite close. https://community.safe.com/s/question/0D54Q000080hfA1SAI/question-of-the-week-dynamic-but-hacky-updates-to-published-parameter-choices. So this might also be an option. Using FeatureReader instead does also seem to do the trick. I am only stuck at the step to the user only to choose one option instead of choosing several options


nwse
Contributor
Forum|alt.badge.img+1
  • Contributor
  • June 9, 2025

@joy in the article you mentioned (https://community.safe.com/s/question/0D54Q000080hfA1SAI/question-of-the-week-dynamic-but-hacky-updates-to-published-parameter-choices) ​@mark2atsafe uses ‘Feature Types to Read’ user parameter, however, is it just me or does this not exist in FME 2025? I cannot find it anywhere.

How did you use a FeatureReader transformer to do this, or at least get close to doing it?


virtualcitymatt
Celebrity
Forum|alt.badge.img+36
nwse wrote:

@joy in the article you mentioned (https://community.safe.com/s/question/0D54Q000080hfA1SAI/question-of-the-week-dynamic-but-hacky-updates-to-published-parameter-choices) ​@mark2atsafe uses ‘Feature Types to Read’ user parameter, however, is it just me or does this not exist in FME 2025? I cannot find it anywhere.

How did you use a FeatureReader transformer to do this, or at least get close to doing it?

Probably the best way to get the Feature Types to Read parameter is to throw down a FeatureReader and then create the parameter directly from within the transformer
 


 


nwse
Contributor
Forum|alt.badge.img+1
  • Contributor
  • June 11, 2025

@virtualcitymatt this was exactly what I was looking for! Thank you so much!

I managed to execute what I needed within FME Form (dynamically providing a selection list within a user parameter), however, now I am running into issues on Flow, ugh!

The structure of my workflow is:

1. I have one workbench uploaded to flow that runs every night. It generates a CSV with layer names. Within that same workbench, it uses a sqlite writer to write those names as tables to a sqlite file. Example, 138 values were written to the CSV, and then in a single sqlite file, there are 138 tables with those same layer names.

2. In the main workbench, I have a Creator into FeatureReader that reads the sqlite file, and then in Feature Types to Read, I have the user parameter.

When I run the workbench, the user parameter dynamically populates based on those values in the CSV. Perfect, it's exactly what I needed, however, the problem comes when publishing this to Flow.

When I publish the workbench to Flow, the user parameter is empty. 

I tried following the second section in the article by ​@mark2atsafe, where, I read the CSV file, aggregated each value onto 1 line with % as the concatenation value, and then used the AttributeReader to bring in the .fmw file. I then found the section of the user parameter and used a string replacer to replace with the aggregated attribute, and then used the AttributeWriter to overwrite the .fmw file. For some reason, however, the values are not showing up in the parameter, both in Form and on Flow.


virtualcitymatt
Celebrity
Forum|alt.badge.img+36
nwse wrote:

@virtualcitymatt this was exactly what I was looking for! Thank you so much!

I managed to execute what I needed within FME Form (dynamically providing a selection list within a user parameter), however, now I am running into issues on Flow, ugh!

The structure of my workflow is:

1. I have one workbench uploaded to flow that runs every night. It generates a CSV with layer names. Within that same workbench, it uses a sqlite writer to write those names as tables to a sqlite file. Example, 138 values were written to the CSV, and then in a single sqlite file, there are 138 tables with those same layer names.

2. In the main workbench, I have a Creator into FeatureReader that reads the sqlite file, and then in Feature Types to Read, I have the user parameter.

When I run the workbench, the user parameter dynamically populates based on those values in the CSV. Perfect, it's exactly what I needed, however, the problem comes when publishing this to Flow.

When I publish the workbench to Flow, the user parameter is empty. 

I tried following the second section in the article by ​@mark2atsafe, where, I read the CSV file, aggregated each value onto 1 line with % as the concatenation value, and then used the AttributeReader to bring in the .fmw file. I then found the section of the user parameter and used a string replacer to replace with the aggregated attribute, and then used the AttributeWriter to overwrite the .fmw file. For some reason, however, the values are not showing up in the parameter, both in Form and on Flow.

Yeah too bad it doesn't work in FME Flow

That’s right - the workspace method now is a bit more tricky. Since the change of the UI for the parameters, I think back with FME 2022, the whole user parameters section is now encoded in json. The JSON parameters are then serialized as a base64 string in the workspace.

The line you want to look at starts with “FORM” e.g.,

FORM="eyJwYXJhbWV0ZXJzIjpbeyJuYW1lIjoiU291cmNlRGF0YXNldF9QT1NUR0lTIiwicHJvbXB0IjoiQ29ubmVjdGlvbiIsInNob3dQcm9tcHQiOnRydWUsInZhbHVlVHlwZSI6InN0cmluZ0VuY29kZWQiLCJyZXF1aXJlZCI6dHJ1ZSwiZGVmYXVsdFZhbHVlIjoiIiwiY2hvaWNlU2V0dGluZ3MiOnsiY2hvaWNlU2V0IjoiZGJDb25uZWN0aW9ucyIsImZhbWlseSI6IlBvc3RncmVTUUwiLCJmb3JtYXQiOiJQT1NUR0lTIn0sInR5cGUiOiJkcm9wZG93biJ9LHsibmFtZSI6IlNPTUVfUEFSQU1FVEVSIiwicHJvbXB0IjoiU29tZSBzdHJpbmciLCJzaG93UHJvbXB0Ijp0cnVlLCJ2YWx1ZVR5cGUiOiJzdHJpbmciLCJyZXF1aXJlZCI6dHJ1ZSwiZGVmYXVsdFZhbHVlIjoiIiwidHlwZSI6InRleHQiLCJzaG93RWRpdEJ1dHRvbiI6ZmFsc2V9LHsibmFtZSI6IlNPTUVfQ0hPSUNFIiwicHJvbXB0IjoiU29tZSBjaG9pY2UgcGFyYW1ldGVyIiwic2hvd1Byb21wdCI6dHJ1ZSwidmFsdWVUeXBlIjoic3RyaW5nIiwicmVxdWlyZWQiOnRydWUsImRlZmF1bHRWYWx1ZSI6IiIsImNob2ljZVNldHRpbmdzIjp7InNvcnQiOiJuYXR1cmFsU29ydCIsImNob2ljZXMiOlt7ICJkaXNwbGF5IiA6ICJjaG9pY2UgMSBkaXNwbGF5IiwgInZhbHVlIiA6ICJjaG9pY2VfMSIgfSx7ICJkaXNwbGF5IiA6ICJjaG9pY2UgMiBkaXNwbGF5IiwgInZhbHVlIiA6ICJjaG9pY2VfMiIgfV0sImNob2ljZVNldCI6InVzZXJEZWZpbmVkIn0sInR5cGUiOiJsaXN0Ym94IiwiZGVsaW1pdGVyIjoiICIsInNpbmdsZVNlbGVjdGlvbiI6ZmFsc2UsImFsbG93T3JkZXJpbmciOmZhbHNlfSx7Im5hbWUiOiJTT01FX0xPR0lDQUwiLCJwcm9tcHQiOiJZZXMgLyBObyIsInNob3dQcm9tcHQiOnRydWUsInZhbHVlVHlwZSI6InN0cmluZyIsInJlcXVpcmVkIjp0cnVlLCJkZWZhdWx0VmFsdWUiOiIiLCJzdXBwb3J0ZWRWYWx1ZVR5cGVzIjpbIm5vbmUiXSwidHlwZSI6ImNoZWNrYm94In1dfQ=="

If you take this base64 string (between the quotes) and decode it you get the JSON for the parameters.

e.g., 
 

{
   "parameters":[
      {
         "name":"SourceDataset_POSTGIS",
         "prompt":"Connection",
         "showPrompt":true,
         "valueType":"stringEncoded",
         "required":true,
         "defaultValue":"",
         "choiceSettings":{
            "choiceSet":"dbConnections",
            "family":"PostgreSQL",
            "format":"POSTGIS"
         },
         "type":"dropdown"
      },
      {
         "name":"SOME_PARAMETER",
         "prompt":"Some string",
         "showPrompt":true,
         "valueType":"string",
         "required":true,
         "defaultValue":"",
         "type":"text",
         "showEditButton":false
      },
      {
         "name":"SOME_CHOICE",
         "prompt":"Some choice parameter",
         "showPrompt":true,
         "valueType":"string",
         "required":true,
         "defaultValue":"",
         "choiceSettings":{
            "sort":"naturalSort",
            "choices":[
               {
                  "display":"choice 1 display",
                  "value":"choice_1"
               },
               {
                  "display":"choice 2 display",
                  "value":"choice_2"
               }
            ],
            "choiceSet":"userDefined"
         },
         "type":"listbox",
         "delimiter":" ",
         "singleSelection":false,
         "allowOrdering":false
      },
      {
         "name":"SOME_LOGICAL",
         "prompt":"Yes / No",
         "showPrompt":true,
         "valueType":"string",
         "required":true,
         "defaultValue":"",
         "supportedValueTypes":[
            "none"
         ],
         "type":"checkbox"
      }
   ]
}


if you want to use this method then you will need to extract this base64 string, decode it, modify the JSON, reencode it and then update the workspace. Just don’t expect it to keep working with updates to FME versions. This is something to do only if you’re desperate and if you’re prepared for it to break. - You may also break your workspace so make sure you have a back up!
 


nwse
Contributor
Forum|alt.badge.img+1
  • Contributor
  • June 12, 2025

Thank you very much for taking the time to provide such thorough explanations, ​@virtualcitymatt .

I had no idea that the user parameters are now encoded in JSON, that certainly clears up the problems and confusion I was experiencing.

Out of curiosity, I examined FORM="XJlZCI6dHJZSwiZGVsdFWNlU2V0dGluZ3MiOnsiY2hvaWNlU2V0Ijoi" by decoding and formatting it, and indeed, the values were clearly there.

@mark2atsafe  had come up with a very smart approach for handling this, but as new FME versions come out, dynamic user parameters seem to pose a new set of challenges. Hopefully, there will be other effective solutions available in the future.

Once again, thank you, Matt, for all of your guidance and info. I sincerely appreciate it.


virtualcitymatt
Celebrity
Forum|alt.badge.img+36
nwse wrote:

Thank you very much for taking the time to provide such thorough explanations, ​@virtualcitymatt .

I had no idea that the user parameters are now encoded in JSON, that certainly clears up the problems and confusion I was experiencing.

Out of curiosity, I examined FORM="XJlZCI6dHJZSwiZGVsdFWNlU2V0dGluZ3MiOnsiY2hvaWNlU2V0Ijoi" by decoding and formatting it, and indeed, the values were clearly there.

@mark2atsafe  had come up with a very smart approach for handling this, but as new FME versions come out, dynamic user parameters seem to pose a new set of challenges. Hopefully, there will be other effective solutions available in the future.

Once again, thank you, Matt, for all of your guidance and info. I sincerely appreciate it.

I think the way forward will be through scripted selection parameters - https://docs.safe.com/fme/html/fpkg-sdk/advanced/scripted-selection/

It’s certainly a better option than hacking the workspace. I think these should also work on FME Flow as well. 


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