Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.

Character limit for expression?

There was a previous question on this but the question wasn't answered since the person realized the problem was something else. 

I'm using script to generate a expression that is over 1000 line long, and it doesn't seem to be going through. This is the error I'm getting. I reduced the line counts of the expression and the error seems to disappear at around 200 lines. So, is there a character limit to how long expression can be?

捕获.PNG

 

Alternatively, is there a better way to implement 2D arrays with AppSheet that isn't 1000 line of nested IFS()? Specifically what I'm trying to do is implement this weight by age chart (attached)gr1.png for children growth to get the percentile a child is in. 

 
 

 

 

 

Solved Solved
0 6 604
1 ACCEPTED SOLUTION

Yes, as @Suvrutt_Gurjar suggests you want to use a lookup table.  You would have it setup something like this:

IDAge(Months)Min WeightMax WeightPercentile
71352216204.40th-3st
3283625824.44.53rd-5th
6870765524.54.95th-15th
4429485224.95.115th-25th
9770060025.15.625th-50th
3191837725.6650th-75th
29888201266.3 75th-85th
...............

To use this table, you would ask in a Form for the Age and Weight of the child.  Then you would use those in an expression like below to lookup the Percentile:

ANY(SELECT(Percentiles[Percentile], AND([Age] = [_THISROW].[Age],
   [Min Weight] > [_THISROW].[Weight],
[_THISROW].[Weight] <= [Max Weight])))

There is work in creating the table but its a one time effort, unless the Percentiles shift but then it's just simple adjustments in the table.

View solution in original post

6 REPLIES 6
Top Labels in this Space