Select to view content in your preferred language

Syntax for calculations referencing a specific repeat record

2431
12
Jump to solution
10-22-2019 11:36 AM
ByronTsang
Occasional Contributor

Is there a pulldata() syntax or some other way to perform calculations on a specific/previous record or records within a repeat? I am trying to make a series of calculations that compare the values between sequential records in a repeat.

For example, I have a repeat for collecting data for trees adjacent to a sample location.  For report formatting purposes, these need to be recorded in descending diameter (largest tree to smallest). Within the repeat I have two user-entry fields ${treespecies} and ${treediameter}.

I want to also include a note to alert the user if they enter a value larger than a value in a previous repeat. I was hoping to use the Relevant function with a formula along the lines of:

(${treediamater, [previous value]} >= ${treediamater, [current value]}).

Another useful alert would be for assigning values for unusually large trees, for example a warning if a tree diameter is more than double the average diameter across all repeat entries.

0 Kudos
12 Replies
RobertGeitner
Occasional Contributor

Doug,

I changed all the type in Column 1 to either decimals or calculations, and up to line 48 everything works fine as usual. However, I highlighted line 49-53 in red because those calculation values continue to convert to either 0's or 1's.  I see the values they are pulling from in Connect and they are the correct number (i.e. .25 or .50), but as soon as I pull those numbers into the next calculation they turn into 0's or 1's so my multiplication is then thrown off.   

I have tried this with multiple different XLSForms and they all seem to do the conversion to 0's and 1's.  Not an aggregate issue, just a rounding issue.  Can you look at this new version once more?

Thank you,

Rob

0 Kudos
DougBrowning
MVP Esteemed Contributor

Your form is hard to follow with all the converting of numbers.  I do not think you need any of that.  All the if(0,1) can just bind to int and be done.

Big ones

I moved the end repeat up to line 24 since I think sum must be outside the repeat to work.

49-52 should be decimal type not int

Removed int bind from lines 28 to 52 since these should be decimal.  You are doing a div then bind to int so of course you get 0 since it is 0.6666 int drops the digits.

I see values now.

DougBrowning
MVP Esteemed Contributor

Just saw today that Collector now has this kind of.

Reuse Field Entries

Now you can easily reuse values that you previously entered into your form to minimize repetitive data entry and spelling mistakes. This can be quite useful when entering frequently used text such as a street name or Inspector.

Directly above the keyboard, in the keyboard accessory view, you can tap on “Recent Values” and find up to 3 previous values entered for that field to choose from.

What’s New in Collector for ArcGIS (January 2020) 

0 Kudos