Skip to main content
Question

Set Up a User Parameter to handle Multiple Text results For SQL 'IN' Operator


I am needing to set up a user parameter that will list text values.

For Example,

PR01

 

EZ01

 

BR01

The Idea here is to be able to use this list with an SQL Creator as such:

In FME -- Select * from <table> where Sys_Code IN ($(sys_code))

Or Oracle SQL -- Select * from <table> where Sys_Code IN ('PR01','EZ01','BR01')

Any help is appriciated.

6 replies

Forum|alt.badge.img+2

Hi @jberneathy,

You can do this by creating a Published Parameter in the Navigator under User Parameters. Set the type to 'Choice' and then in the configuration you can add in the different text values for the user to choose from. You can then use this parameter in your SQL query.


  • Author
  • July 24, 2018
hollyatsafe wrote:

Hi @jberneathy,

You can do this by creating a Published Parameter in the Navigator under User Parameters. Set the type to 'Choice' and then in the configuration you can add in the different text values for the user to choose from. You can then use this parameter in your SQL query.

Is there a way FME can do this automatically from an Oracle table? There are hundreds of them, and manually placing each one, and adding new ones as they come doesn't seem sificient.

 

 


Forum|alt.badge.img
  • July 24, 2018

Your parameter definition:

And the code to build the query:

The StringReplacer replaces the spaces by (',') when more than one code is selected.

Workspace is attached.


takashi
Influencer
  • July 25, 2018
hollyatsafe wrote:

Hi @jberneathy,

You can do this by creating a Published Parameter in the Navigator under User Parameters. Set the type to 'Choice' and then in the configuration you can add in the different text values for the user to choose from. You can then use this parameter in your SQL query.

If you want to import the hundreds choices from an external Oracle table, try using the Import button in the Edit Choices List dialog.

 

Note that the imported choices list will be fixed, won't be imported at run-time dynamically. If the choices list table in the Oracle database would have been changed (added or deleted a choice), you would have to re-set the choices list in the parameter definition.

 


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • July 25, 2018

@jberneathy

I don't think that will cover all options.

Unless it has been improved, one of the problems is comma's spaces special characters etc..

Therefore I prefer to use multi choice parameter with alias. I then replace the spaces with commas. This averts the nescissity to handle all the specialcharacters etc.

The double regsub is caused by a irritating and still lasting problem in the way fme handles commas in the regexp.

So in this example, choosing all options

1 0 7 5 3 8 6 4 2 9 is transformed to 1,0,7,5,3,8,6,4,2,9 by the scripted parameter (TCL)

When called by a WSR I have the string parsed in a transformer as the tcl scripted parameter are not run. (at least at the time I build this. It is upgraded to latest version now and still works)

(it is a custom transformer with a lot of options to access a lot of dataset/bases whilst using some polygon as filter. Single transformer map builder.)


Forum|alt.badge.img
  • July 25, 2018
jberneathy wrote:
Is there a way FME can do this automatically from an Oracle table? There are hundreds of them, and manually placing each one, and adding new ones as they come doesn't seem sificient.

 

 

We developed a C# .Net application using an XML file in input that is taking care of re-injecting the parameter values on demand (each time the Oracle source tables are updated). Let me know if your are interested. And if the workspace is published to FME Server, we've also automated this part. As an example, each time a workspace is committed in our source control, we are able to automatically update the parameters and publish to FME Server.

 

 


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