Select to view content in your preferred language

Auto-populate dates in repeat table

321
3
Jump to solution
a month ago
Cyprus_Forest_Department
Frequent Contributor

Hi.

I have a problem in my form that keeps track of Leases Payments and their Revision Periods.

I have attached the excel file that I explain bellow.

The user enters the PaydownDate and the LeaseRevis_Years. The first record of the repeat that would populate the StartDate should be the PaydownDate record.

The first record of the repeat to populate the EndDate should be the PaydownDate plus the number of years that correspond to the LeaseRevis_Years.

Upon clicking the "+" next record button, the user should find prepopulated both StartDate and EndDate for the second record.

The StartDate should be the EndDate from the former record, and the EndDate should be the StartDate that was populated for the current record plus the anumber of years that correspond to the LeaseRevis_Years.

And so on and so forth.

Is that possible with calculations. I tried with "if statements" including the "Position" formula but got stuck in cycle dependency errors.

Any help is welcome.

Thanks in advance.

0 Kudos
1 Solution

Accepted Solutions
Neal_t_k
Frequent Contributor

@Cyprus_Forest_Department This was tricky, but I think this should be what you are after.  I was running into probably the same cyclic dependancies you were, but if I am understanding correctly you can base the end date on a straight calculation of the the initial paydownDate and Lease period, and that got rid of the dependency.

See attached.

One thing that is not accounted for is leap year, I haven't seen a good, easy way to account for it...

Edit:

After thinking about I think you could just calculate the StartDate in the same manner.

date(decimal-date-time(${PaydownDate})+${LeaseRevis_Years}*365*(position(..)-1))

View solution in original post

0 Kudos
3 Replies
DeonLengton
Esri Regular Contributor

Hi

You can try using the indexed-repeat function to retrieve the previous repeat's values...

indexed-repeat(${EndDate}, ${LeaseDates}, position(..)-1)

This will fetch the previous repeat End Date and could then be populated in the current record's Start Date for instance.

To add to a date you can reference Ismael's blog post:

https://community.esri.com/t5/arcgis-survey123-blog/dates-and-time-in-survey123/ba-p/895528

 

0 Kudos
Neal_t_k
Frequent Contributor

@Cyprus_Forest_Department This was tricky, but I think this should be what you are after.  I was running into probably the same cyclic dependancies you were, but if I am understanding correctly you can base the end date on a straight calculation of the the initial paydownDate and Lease period, and that got rid of the dependency.

See attached.

One thing that is not accounted for is leap year, I haven't seen a good, easy way to account for it...

Edit:

After thinking about I think you could just calculate the StartDate in the same manner.

date(decimal-date-time(${PaydownDate})+${LeaseRevis_Years}*365*(position(..)-1))
0 Kudos
Cyprus_Forest_Department
Frequent Contributor

Thank you both for your kind help. I will follow the "date" formula approach. Best regards.

0 Kudos