# Array returning incorrect values

**URL:** <https://community.glideapps.com/t/array-returning-incorrect-values/68856>\
**Category:** Ask for Help\
**Created:** [December 19, 2023, 9:21pm UTC](https://community.glideapps.com/t/array-returning-incorrect-values/68856 "2023-12-19T21:21:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ckinross](https://avatars.discourse-cdn.com/v4/letter/c/3ab097/32.png) [@ckinross](https://community.glideapps.com/u/ckinross)\
**Post date:** [December 19, 2023, 9:21pm UTC](https://community.glideapps.com/t/array-returning-incorrect-values/68856/1 "2023-12-19T21:21:32Z")

</div>

I have an array of badges, each with a status of either ‘earned’ or ‘unearned.’ The image displayed for each badge is dependent upon the status. For example, a badge that is ‘earned’ is full color while a badge that is ‘unearned’ is greyed out.

With help from many people in this community, the following is in place in my Users data sheet.  
✅have a comma delimited list of all earned and unearned badges  
✅have a split text column that splits it into an array  
✅have a relation linking the array to the badge table

Here’s where things become odd.

- There are a total of 29 possible values that correspond to either a full color badge or greyed out badge.
- While generating the CSV, values greater than 29 appear. These appear to be concatenations of actual values. For example “18” is a legitimate value but “1818” appears as one of the values.  
 ![Screenshot 2023-12-19 at 1.10.18 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/3/a3a001abe5386725e4642f832b4d52583426c8a0.png)

The unexpected numbers get carried into the subsequent array, making this badge invisible. You can see in this view that 9 badges are displayed but that there should be 12 badges. The number of badges actually displayed per user corresponds to the number of badges with valid numbers in the CSV.

 ![Screenshot 2023-12-19 at 1.18.27 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/7/b7cc3203abd5fed26dd94877d181fe7e72a25829.jpeg)

The CSV is a template column. (You can ignore the formatting difference between the first two and the subsequent 10. This is not the error).

 ![Screenshot 2023-12-19 at 1.20.12 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/c/0c39c119323706b7275b65c0b86a431a8206c59f.png)

Has anyone seen this before?  
Thank you

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [December 19, 2023, 9:33pm UTC](https://community.glideapps.com/t/array-returning-incorrect-values/68856/2 "2023-12-19T21:33:47Z")

</div>

Instead of using 1,2,3,4 use a,b,c,d… better yet use {a}, {b}, {c}, {d}… I think your code is running over itself

---

<div class="post-metadata">

**Author:** ![ckinross](https://avatars.discourse-cdn.com/v4/letter/c/3ab097/32.png) [@ckinross](https://community.glideapps.com/u/ckinross)\
**Post date:** [December 19, 2023, 9:37pm UTC](https://community.glideapps.com/t/array-returning-incorrect-values/68856/3 "2023-12-19T21:37:51Z")

</div>

Bravo! That did indeed solve the issue. Thank you for teaching me an important skill.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [December 19, 2023, 9:40pm UTC](https://community.glideapps.com/t/array-returning-incorrect-values/68856/4 "2023-12-19T21:40:30Z")

</div>

@Eric_Penn nailed the issue and resolution. 1 is replacing the 1 in 1, 10, 11, and 12.  
Also consider using a Make Array column instead of a Template and Split Text. It should do the same thing with one column instead of two.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [December 26, 2023, 9:41pm UTC](https://community.glideapps.com/t/array-returning-incorrect-values/68856/5 "2023-12-26T21:41:12Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
