Passing a field to a script parameter flattens the list. How do we fix that?

I've got a script that normally has script parameters passed via the "parameter" input field. The script expects one or two positional parameters. At present that is handled like this:

List ( "color"; "weight" )

I am making testing changes and I am passing in the values from a field. The field is like this:


The script parameter looks like this "color¶weight", and to the trained FMP dev that is going to be a list of two values. But in this case GetValue( Get( ScriptParameter) ; 1 ) returns "color¶weight" and GetValue( Get( ScriptParameter) ; 2 ) returns empty.

After inspecting the value it turns out that the pilcrow is not representing a line feed. It is Char(182).

I can convert the string to a list using Substitute ( Get ( ScriptParameter ) ; Char(182) ; ¶ ).

Is there anything I can do to make the script see a list instead of a string that contains a plicrow?

I can get that "¶" is not the same as ¶ - my guess is that FileMaker replaces ¶ by linefeed - what I don't get is that List ( "color"; "weight" ) would insert the pilcrow as a character instead of linefeed :thinking:.

Do you get this with only a specific version of FMP/FMPA or with many versions ? Passing a list as a parameter is something done so frequently.

1 Like

@Malcolm this sounds very strange. It should not be behaving like that. Is it possible you are passing your parameter like this by accident?:
Quote ( List ( MyTable::color ; MyTable::weight ) )

That would result in the "stringified" list you describe.

pass list.fmp12 (264 KB)

I think I misunderstood.
You said

The field is like this:

meaning the contents of the field are color¶weight (I assume). My bad.

Are you quoting the field value before passing it in? like: Quote ( Table::fieldThatContainsTheList ) . If so, try passing it in without quoting and each value should be accessible with GetValue()

FIXED EXAMPLE: pass list RAW.fmp12 (264 KB)


Yes. I'd forgotten that the data being sent to the script was being processed. The code looks like this:

["|sp|" ; Quote ( ScriptParameter ) ]

OK, so that's why Char(13) is being turned into Char(128) / "¶".


becomes "color¶weight" if you wrap it in Quote()


@jwilling has it. Quoting field values substitutes the pilcrow for the EOL.

Please also note: with the release of FileMaker 17, Claris updated the documentation of the ValueCount() function. The updated doc mentions there are actually 4 different characters that will behave as separating values (the carriage return being one of those and the only one the quote function escapes).

This, in my opinion, makes the Quote function unreliable to use to move text around with the intent of isolating values from one another, and can be very dangerous if the input relies on anything the user has access to.

More details here: Claris Community (English)

Sounds like a good candidate for moving the whole parameter passing over to JSON, surely?

JSONSetElement ( "{}" 

; [ "color" ; "red" ; JSONString ]
; [ "weight" ; "1Kg" ; JSONString ]


to give:

"color" : "red",
"weight" : "1Kg"


@JamesG, agreed. Any rewriting may as well move toward named parameters and JSON is a good option.