function buildArrayfromFlatOne T, d1, d2
local A, X
set the itemdel to d1
repeat for each item L in T
set the itemdel to d2
put the number of items of L into n
put format( "put %s into A", item n of L ) after X
repeat with i= 1 to n-1
put "[" &quote& item i of L &quote& "]" after X
end repeat
put cr after X
set the itemdel to d1
end repeat
do X
return A
end buildArrayfromFlatOne

local myArray
put buildArrayfromFlatOne( fld "flatArray", return, " - " ) into myArray
get flattenArray( myArray, return , " - ")
-- test if original flatArray and new one are the same
sort IT
put IT into fld "flatArray2"
if IT is (the text of fld "flatArray") then get "Good, back with same values :)"
else get "Sorry, do your homework :("
answer IT