Syntax for calculations referencing a specific repeat record

1788
12
Jump to solution
10-22-2019 11:36 AM
ByronTsang
New Contributor II

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
1 Solution

Accepted Solutions
JamesTedrick
Esri Esteemed Contributor

Hi Byron,

There currently isn't a direct method for accessing a previous repeat's value in another repeat.

View solution in original post

0 Kudos
12 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Byron,

There currently isn't a direct method for accessing a previous repeat's value in another repeat.

0 Kudos
RobertGeitner
New Contributor III

So after a repeat I get a decimal calculation, but I am not allowed to extract that value and use it in another calculation?

0 Kudos
RobertGeitner
New Contributor III

James, 

I am only returning 0s and 1s from my calculation, yet it is a decimal between 0 and 1.  I have attempted to edit the bind:type as well as the type to see if I insert int. or decimal and nothing seems to come back correct.  Do you have any idea what I am doing wrong?

Thank you,

Rob

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Robert,

In the file you submitted today, your decimal questions have a bind::type of int, which indicates that the result will be an integer. Removing that will cause the formula to work correctly

DougBrowning
MVP Esteemed Contributor

If you are for sure doing them in order then my trick listed here should work

Populate a field within a repeat from a previous entry within same repeat? 

You can use sum and count across a repeat to handle your other question.  

See here  Formulas—Survey123 for ArcGIS | Documentation 

0 Kudos
RobertGeitner
New Contributor III

Hey Doug and James,

I have been working on this for about 4 months, and I can get the calculations I need from the repeat outside the repeat.  Everything worked fine on that, and I can see the calculations value as a decimal in connect outside the repeat.  I then want to use that decimal to use in one final calculation but for some reason it turns those decimal values into a 0 or a 1.  I actually put the calculations in the 'label column' as well so in Connect I can actually see the values they are pulling and that is how I know they are using 0s and 1s.  I would like to attach the file and have one of you look at it because I am utterly beat at this point. 

Please let me know what you find!  Your help would be much appreciated. 

Rob

0 Kudos
DougBrowning
MVP Esteemed Contributor

You did not attach anything.

0 Kudos
RobertGeitner
New Contributor III

Doug, 

Sorry, the real issue is that my calculation work but when I go to use them in a proceeding calculation they turn into 1's or 0's.  Thanks for the help.


Cheers,

Rob

0 Kudos
DougBrowning
MVP Esteemed Contributor

Why do you have all of these as type text?  Then you bind to int. 

I would think just make the type in column 1 decimal.  I think its getting confused as to what type it should be.  Line 58 works since it is decimal.

Just a guess.

0 Kudos