Hi,
I count the number of records related to a specific task this way:
pulldata("@layer", "getValue", "attributes.totalcount", concat(${url_query}, '?outStatistics=[{"statisticType": "count","onStatisticField": "objectId","outStatisticFieldName": "totalcount"}]'), concat("task_id ='",${task_id},"'"))
where ${url_query} is the feature layer url and ${task_id} the filter value for the task_id attribute.
It works fine but it seems that Survey123 is caching the result of the request which means that when I create another record related to the same task, the count is not updated.
I was able to confirm that by looking at the requests done by Survey123 with a tool like Fiddler.
This is really annoying for our workflow as it means that Survey123 has to be stopped and restarted for the request to be sent and the count updated.
Could this behaviour be changed?
Thanks,
Olivier
Solved! Go to Solution.
Maybe try adding a cache buster parameter to the URL? Something like "xyz=1234567890" where the number is randomly generated?
Maybe try adding a cache buster parameter to the URL? Something like "xyz=1234567890" where the number is randomly generated?
Great idea, it works, thanks.
I just changed my call like this:
pulldata("@layer", "getValue", "attributes.totalcount", concat(${url_query}, '?outStatistics=[{"statisticType": "count","onStatisticField": "objectId","outStatisticFieldName": "totalcount"}]'), concat("task_id ='",${task_id},"' and task_id <>'",string(random()),"'"))
I have ran into the same issue, but I am using getRecord instead of getValue. I have a field (form_json) to store the json with it's calculation looking like this:
pulldata("@layer", "getRecord", "<PortalURL>?orderByFields=readingtime2 DESC", "1=1")
I then use pulldata again to populate the field I want with:
pulldata("@json",${form_json},"attributes.hscurrentmeterread")
I'm unsure how to use the random function as you did above to make my call refresh every time.
I was finally able to get it. Needed to remove 1=1
Hey guys, this is a really useful topic, I am trying to get the count of concrete selection on a field, and that's working well, but when I try to combine with other field to get the data filtered by both fileds it shows nothing...
pulldata("@layer", "getValue", "attributes.totalcount", concat(${URL}, '?outStatistics=[{"statisticType": "count","onStatisticField": "objectId","outStatisticFieldName": "totalcount"}]'), concat("lugar ='",'Casco Antiguo',"' and fecha_de_la_Recogida ='",${fecha_de_la_Recogida},"'"))
Ok, I just managed to see that the URL for the first field was in the general table (/0) and the last one in the repeat (/1), so I made another line:
pulldata("@layer", "getValue", "attributes.totalcount", concat(${URL2}, '?outStatistics=[{"statisticType": "count","onStatisticField": "objectId","outStatisticFieldName": "totalcount"}]'), concat("fecha_de_la_Recogida ='",${fecha_de_la_Recogida},"'"))
But even with this alone I cannot get any result 😞
Anyone can help me to figure this out? Thanks in advance!!
any thoughts? 🙂
ideas? 🙂