I am attempting to simplify Arcade expressions using loops. Currently, I have multiple Arcade expressions checking for a condition using "IIf" function to check if a field within pop up of a feature layer meets a certain condition. I am checking if a field contains 'Y'. If it does then I want it to print "None" or if it doesn't then print "inline". Since I am doing this same process for multiple fields, I have many Arcade expressions doing this same "IIf" function.
First part:
I wanted to attempt to use loop to simplify this. My initial thought is to store the fields that I am checking for 'Y' in an array and run a loop on that array. Basically, for each position of the array (which contains the field name), I would be checking the fields using "IIf" function and return the result ("None" if contains 'Y' and "inline" for 'N').
Second part:
Once the first part is completed, I want to add another array which contains the field name itself from the feature layer or I can store the field name as a text manually. I want to correspond that field name with the result of the first part above. For example, if I have a field name as "Bike" and from the first part above, the "IIf" function finds it to be "None", I want the the final result to be "Bike None".
How would I do this in Arcade? Any thoughts? Thank you!