I've struggled to work this one out and finally need to turn to the community for help. I have a repeating array with many nested arrays (all fake data btw), where I want to extract the firstnames, lastnames and nhs number. The tricky part is that the nhs number is sometimes under the first nested array of [partyAddtionalInfo] and sometimes under the second.
My attempt, which works feels a bit clunky.
Code: Select all
repeat for each Key temp in tParties
repeat for each Key temp2 in tParties[temp][partyAdditionalInfo]
repeat for each key temp3 in tParties[temp][partyAdditionalInfo][temp2]
if tParties[temp][partyAdditionalInfo][temp2][temp3] is "uk.nhs.nhs_number" then
put tParties[temp][partyAdditionalInfo][temp2]["value"] into tNHSNumber
end if
end repeat
end repeat
put tNHSNumber && tParties[temp][firstNames] && tParties[temp][lastNames] & cr after tPatientList
end repeat
I could leave my solution as is, but I'm keen to understand any better ways.