HI all,
I'm trying to parse data from a .txt file which contains data as mentioned below using readTextFromFile() function.
Text in file :" 1 abc def xyz 02/02/2020 aaa zzz"
ouput of readTextFromFile() function: "1 abc def xyz 02/02/2020 aaa zzz"
Expected output: text array like {"1", "abc", "def", "xyz", "02/02/2020, "aaa", "zzz"}
Kindly suggest on framing the expression rule to remove the white spaces from the text and then placing each text at different index as mentioned above
Peter Lewis kindly suggest
Discussion posts and replies are publicly visible
try this:
fn!split("1 abc def xyz 02/02/2020 aaa zzz", " ")
I can't find any documentation that supports the the behavior you describe as expected. How did you arrive at that conclusion?
I half suspect that the text file might be tab-separated (just based on how it looks when pasted here), and then the Appian expression output is just trimming those tabs down to single spaces. Either way this should be easy to parse, but might require extra handling in the rule.
Yes Mike Split worked for me.
I have used below code.
a!localVariables( local!fileData: readtextfromfile( txtFile:ri!file, preserveLineBreaks:true() ), local!dataArray: if( rule!APN_isEmpty(local!fileData), {}, a!forEach( items: split( local!fileData, rule!APN_replaceNull(fn!char(9), ";") ), expression: trim(fv!item) ) ), local!dataArray)