Two Variables in same expression
I'm sure this is just a syntax thing.
I have a dynamic query set up which returns a different field based on user input at run time (stored in a value called key). So the first instance it could return the value in field A, the second time it could return the value in fieldB. Effectively the outfield of the query is just set to $key.value.
The issue comes when I need to use this value later on. I cant hardcore
=$SelectedFeatures2.feature.attributes.fieldA rather I need to make it a bit more dynamic to get the correct field.
=`${$SelectedFeatures2.feature.attributes.${$key.value}}` I've been trying many variations on this but no matter what I try it seems to be wrong.
Any ideas of the correct syntax for it? I'm sure its simply, I'm just still getting used to using this syntax vs .net.
-
Hi Shawn,
For this kind of case, try the alternate format, feature["attributeName"] instead of feature.attributeName. Eg.
=`${$SelectedFeatures2.feature.attributes[$key.value]}`0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
1 Kommentar