Select to view content in your preferred language

Calculating the highest value of a field

229
9
Thursday
dsinha
by
Frequent Contributor

Hello all,

I am using the solution suggested by Ismael in this post to calculate the next highest value in the idlong field.

dsinha_0-1777575672118.png

There are no error messages but the value that is being produced is 401 (in ArcGIS Survey123 Connect) instead of 18320972.

Any clue what I could be doing wrong?

Thanks for your help!

0 Kudos
9 Replies
Neal_t_k
MVP Regular Contributor

Something else you could try: 

pulldata("@layer", "getValue",""attributes.<idlong>", "<url> ?orderByFields=<idlong> DESC"

This should sort greatest to least and return the greatest.

Survey123 Tricks of the Trade: pulldata("@layer") - Esri Community

 

0 Kudos
dsinha
by
Frequent Contributor

Thanks for the suggestion @Neal_t_k. Where should I put the new expression: before I calculate the idlong_count field? 

0 Kudos
Neal_t_k
MVP Regular Contributor

You can replace  the pulldata (@javascript) function with it.  And obviously update the <xyz> with your appropriate info.

0 Kudos
dsinha
by
Frequent Contributor

Sorry @Neal_t_k , it did not work. I am getting a blank now for idlong instead of a value. 

0 Kudos
Neal_t_k
MVP Regular Contributor

Whats your full pulldata() calculation?  or can you share your xlsx example?

0 Kudos
dsinha
by
Frequent Contributor

Thanks for taking the time @Neal_t_k. I have attached the XLSX file. I am also including the javascript.

0 Kudos
Neal_t_k
MVP Regular Contributor

What is the attribute name of the field in your feature service that contains the idlong data.  In your pulldata @javascript function you are referenceing ${idlong} which you are calculating with the results. The results of the calculation should return a number and not a field name. probably why it is returning 401, because it is a cyclic redundancy.  You should hardcode that field name from your feature service instead of referencing a question.  

Neal_t_k_0-1777581174950.png

I still think you  could try using this by replacing "<idlong>" with your field name that contains the idlong data your are trying to return.

pulldata("@layer", "getValue",""attributes.<idlong>", "https://arcgissvr.borough.carlislepa.org/server/rest/services/Hosted/DataCollectionInspection/FeatureServer/0?orderByFields=<idlong> DESC"

 

Hope that makes sense.

dsinha
by
Frequent Contributor

Unfortunately, I am not sure how to hardcade a field name. Thanks for all your help though @Neal_t_k !

0 Kudos
Neal_t_k
MVP Regular Contributor

Right here:

Neal_t_k_0-1777646587323.png

instead of calling a question from the form. insert the name of the field in your feature service corresponding to the idlong data.  so instead of ${idlong}  to would be "idlong" assuming that is your field name.

or in the pulldata @layer it would be:

pulldata("@layer", "getValue",""attributes.idlong", "https://arcgissvr.borough.carlislepa.org/server/rest/services/Hosted/DataCollectionInspection/FeatureServer/0?orderByFields=idlong DESC")
 

again assuming idlong is the field name in the feature service.

 

0 Kudos