Why is eq not working

{{#each pageData.users}}
   <option 
      value="{{id}}" 
      {{#eq ../pageData.device.tags.custodian id}}selected{{/eq}}>
             {{../pageData.device.tags.custodian}} {{id}}
   </option>
{{/each}}

Im unsure why this is comparison is not working to make the option selected when I am printing the values out to visually make sure they are equal.

did something similar here and it worked just fined (its …/this since its inside of another loop)

{{#each (array 1 2 3 4 5 6 7 8 9 10)}}
                <option value="{{this}}" {{#eq ../this.userSettings.minor_email this}}selected{{/eq}}>{{this}}</option>
{{/each}}





edit:

I am even further confused that this worked but eq did not

 {{#includes ../pageData.device.tags.custodian id}}selected{{/includes}}>

Without seeing the render context, it’s tough to know. If those are device tags that come straight from a device object, you may be missing an index since those are always arrays.

pageData.device.tags.custodian.[0]

This is because device tags support duplicate key values. So if you have the same tag key twice, the array has multiple values.

1 Like

Thats it, ive been scratching my head staring at this wondering why it would print just fine but not compare :sweat: Thanks!
I get now that an array will print comma separated but there is no other values to print so its just the single value

We learned our lesson on devices. Supporting duplicate keys made everything downstream harder to work with. As we rolled out tags to other resources, we started requiring tag keys to be unique. Devices are only resource that requires the index.

1 Like

I was just about to access why the lack of consistency on tags. I could see why that would be a headache