How to parse delimited field in FileMaker Pro into a new table
-
28-09-2019 - |
Question
I have a field in my FileMaker Pro database that contains semi-colon delimited data in it so what I want to do is separate that data into a new table. if someone could point me in the right direction that would be helpful
Solution
One way would be to write a script that splits the text into lines (using GetValue()
), then splits each line by semicolon (Substitute( $line, ";", "¶" )
, then GetValue()
from the resulting list), and finally posts the data into the other table (Go to Layout, New Record, Set Field). Can sketch the whole script, if you want.
I'd write it like that:
Go to Layout( My Table )
Go to Record/Request/Page[ First ]
# Loop over records
Loop
Set Variable[ $line, 1 ]
# Loop over lines
Loop
Exit Loop If[ ValueCount( My Table::My Field ) < $line ]
#
# Get line values
Set Variable[ $fields,
Substitute( GetValue( My Table::My Field, $line ), ";", "¶" ) ]
# ...
Go to Layout( My Target Table )
New Record/Request
Set Field[ My Target Table::Foo, GetValue( $fields, 1 ) ]
Set Field[ My Target Table::Foo, GetValue( $fields, 2 ) ]
Go to Layout( My Table )
#
Set Variable[ $line, $line + 1 ]
End Loop
Go to Record/Request/Page[ Next, Exit After Last ]
End Loop
Go to Layout( original layout )
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow