Select to view content in your preferred language

Arcade IIF statement not working

989
2
Jump to solution
06-07-2023 03:02 AM
tendtreesTC
Occasional Contributor

Hi there,

I am trying to use an IIF calculation to determine whether a switch should be selected to 'yes' or 'no' based on a field in the parent data.

When I use the following calculation:

Features = FeatureSetByRelationshipName($feature, 'WCC_Hort_Site_Auditing_XV2X_inspection_audit');

the result is 

tendtreesTC_0-1686131981207.png

However, when I try to input this into an IIF statement:

iif(FeatureSetByRelationshipName($feature, 'WCC_Hort_Site_Auditing_XV2X_inspection_audit',['bedding'])=='yes','yes','no')
 
it returns "no"
 
I imagine it is something to do with the return being a featureSet rather than a straight yes/no
 
Can anyone help me with this calculation?
 
Thank you
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

You're correct in your thinking that it's a question of improperly evaluating a FeatureSet. You have to get a Feature from that FeatureSet to do that. If you're expecting only item to be in the FeatureSet, use First to get that feature and perform your evaluation.

var fs = FeatureSetByRelationshipName($feature, 'WCC_Hort_Site_Auditing_XV2X_inspection_audit');
var feat = First(fs);
iif(feat['bedding']=='yes','yes','no');

 

View solution in original post

2 Replies
KenBuja
MVP Esteemed Contributor

You're correct in your thinking that it's a question of improperly evaluating a FeatureSet. You have to get a Feature from that FeatureSet to do that. If you're expecting only item to be in the FeatureSet, use First to get that feature and perform your evaluation.

var fs = FeatureSetByRelationshipName($feature, 'WCC_Hort_Site_Auditing_XV2X_inspection_audit');
var feat = First(fs);
iif(feat['bedding']=='yes','yes','no');

 

tendtreesTC
Occasional Contributor

that worked great thank you

0 Kudos