Set Property Syntax Help
I am trying to set the property of a value I created. It will store a truck number eg 1 or in some cases it is still null. I have done a query to get the results from the features. It gives me the attributes, one of which is the field name that stores the truck number. My issues is that the field name can be one of 4 - HouseholdTruckNo, GreenTruckNo etc. I already have that field name in another value called 'fieldWasteTypeTruckNo'. So what I'm trying to do is to get the property set to the result of '$forEach4.item.attributes.GreenTruckNo' where GreenTruckNo is stored in a value and is substituted.
The set property works if I hardcode the field name in but I want it to be dynamic based on the 'fieldWasteTypeTruckNo' value.
I have tried all different variations one of which is below
=`${$forEach4.item.attributes}.${$fieldWasteTypeTruckNo.result}`
None of them work. In this example it just returns "[object Object].GreenTruckNo". What is the correct syntax or do I need to achieve this some other way? I was hoping to avoid putting in hardcoded switch options for each field type.
Thank you!
Belinda
-
=`${$forEach4.item.attributes[$fieldWasteTypeTruckNo.result]}`
0
Please sign in to leave a comment.
Comments
1 comment