Question

user parameter question

  • 23 January 2018
  • 6 replies
  • 4 views

Badge +9

I have a tester that lets a shape through when name equals London area, this is fine, but when I add in a user parameter nothing is going through the tester. The only thin I can see is that the user parameter is adding speech marks to the beginning and end of the text string, hence it is not being found. I have imported all of the options from the name field in the shape file.

Any ideas how to solve this?


6 replies

Userlevel 1
Badge +10

If you create an attribute and set it to have the value of the parameter what do you see as the value if you send it to an inspector?

You will probably need to remove the speech marks in some way or edit the tester to include the speech marks.

e.g.

c

Also, do you really want this to be a multiple choice (i.e. can make more than one selection), you will need to do some more handling of the parameter to use in the tester in the way you want.

Badge +2

As @egomm said it is double quoting the parameter values which is there so you can identify the individual parameter values if required. If you only need one value rather than multiple try parameter type Choice as it doesn't quote it.

Userlevel 2
Badge +17

Hi @ingalla, if you actually need a multiple choice parameter and test whether the value of "NAME" matches one of the region names selected through the parameter, this Test clause might help you.

Badge +2

Just remembered that there is a custom transformer created by my colleague in Australia @nic_ran

https://hub.safe.com/transformers/multichoiceparamsplitter

 

Userlevel 2
Badge +17

In fact, the value of a multiple choice parameter can be directly treated as a list in a Tcl script, regardless of a choice string contains a space. For example, a TclCaller with this script populates Euro Zone names selected in the multiple choice parameter into a list attribute called "_zone{}".

proc extractEuroZones {} {
    global FME_MacroValues
    set i 0
    foreach v $FME_MacroValues(EuroZone) {
        FME_SetAttribute "_zone{$i}" $v
        incr i
    }
}

0684Q00000ArL0mQAF.png

Badge +3

use regexp on it and then a scripted parameter.

Here is a example

the choice parameter:

and the tcl scripted parameter to do away with spaces and replace with comma's

then I have custom to deal with the quotes to ultimately creates an "In" string.

It is used for a large series of input parameters in a single workbench.

The quotes are caused by the spaces in the choices ( also happens with other type of characters like d'Ambrusso)

Reply