How to put Count() and Once() in pulldata calculations?

1968
9
02-28-2018 06:58 AM
IrisTheunisse
New Contributor

I’ve a survey including a repeat function. Within this repeat function, pulldata is being used to automatically fill a field (field = categorie in attached documents) based on the repeat generated with count(). This works except from the case when I want to go back to a previous item in my repeat. In that case it overwrites the previous item based on the new count. Therefore, I added the once() function to my pulldata calculations to enable going back to previous repeat items, but then it somehow shows my first entry twice. I cannot figure out why this behavior happens. Do you maybe have any idea or any suggestion about this? See attachment for both survey folders (including xls and pulldata csv files).

0 Kudos
9 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Iris,

I can see the issues you are having - it appears that the once() is not working properly for the first repeat, leading to a trailing numbering sequence.  I've filed an issue to address this.  

0 Kudos
IrisTheunisse
New Contributor

Hi James, 

Thanks! Do you have any idea when this will be solved? Do you know if there is a workaround for this issue? A workaround with which items in a repeat can be automatically filled by using pulldata. Is there maybe a function that can replace the count() function?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Iris,

In my testing, I was receiving the sequence 0,1,2,3 , so adding 1 to the count should work around the issue.  I don't have a specific timeline for resolution.

0 Kudos
JohnathanHasthorpe
Esri Regular Contributor

This issue will be resolved for 3.1.

0 Kudos
joerodmey
MVP Alum

Don't know if this still an issue and if it applies to my issue. Basically I'm using once() to only collect the username of a user via the webform only once and not replace it if a different user logs in. Would this be an issue with once()?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Joe,

Typically, once() is used only in the context of a form session (as opposed to editing forms); that being said, it should work in the context you describe.

0 Kudos
joerodmey
MVP Alum

Hi James,

 

I’ve tried numerous times using once() in calculation field and the expected behavior doesn't occur. My code is:

 

once(if(${Request_Status}='In_Progress',once(${user_status}),"))

 

Thanks

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Joe,

Looking further into this, I don't think you'll be able to achieve what you are wanting through a formula - the act of logging in/logging out on the webform reloads the form, causing an essentially 'new' form to be generated.

0 Kudos
joerodmey
MVP Alum

I believe that you have confirmed my thinking. Do you have another idea or do you need more info?

0 Kudos