I have written a component function to extract a token from a string (eg. tokens stored as k1:v1|k2:v2|... and wish to return the value (eg. v2) from a token (eg. k2).
If I attempt to do so using ForAll in a single pass it returns blank, but if I take the single column table output from the ForAll and extract the result it all works fine.
There is no sync issue, all variables initialised well ahead of time (vDebugTokens=HC:111|FL:222|efw:333|ac:444 and vDebugTokenToFind=efw).
[As an aside, this wouldnt be necessary if JSON read/write for records WITHIN powerapps without resorting to flow was implemented]
//////////////////////////////////////
////Extract to a single column table and then extract result from that collection- WORKS
/////////////////////////////////////////////////
ClearCollect(vDebugTokenPairMatches,
//So split into each key:value
ForAll(Split(vDebugTokens,"|") As KVpairs,
//then if keyX: found
If(StartsWith(Trim(KVpairs.Result), Trim(vDebugTokenToFind & ":")),
//then split that key:value result at the : gives two records-- the last record should be the value
Last(Split(KVpairs.Result,":"))
) //If
) //forAll
); //Collect
Set(vDebugTokenValueTwoFunctions,Trim(First(vDebugTokenPairMatches).Result));
//////////////////////////////////////
/////Extract result from single column table- FAILS
//////////////////////////////////////
Set(vDebugTokenValueOneFunction,
Trim(
First(
//So split into each key:value
ForAll(Split(vDebugTokens,"|") As KVpairs,
//then if keyX: found
If(StartsWith(Trim(KVpairs.Result), Trim(vDebugTokenToFind & ":")),
//then split that key:value result at the : gives two records-- the last record should be the value
Last(Split(KVpairs.Result,":"))
) //If
) //forAll
).Result //First- First found match and return its value
) //Trim the value
); //Set
Reset(TextInput3);Reset(TextInput3_1)

Report
All responses (
Answers (