Is there a simple JS script example (without feature by location) which queries a feature layer and returns all the attributes / records of a layer? and even better what would be the syntax for finding a Max value of an attribute in the host layer? Any help wold be blissfully received.
Solved! Go to Solution.
Hi JMP,
I don't know IdCar? Is it a field name? I can't see it in your function.
I have never really used the fx area in scripts. It doesn't seem to work for me, yet the form & script are returning me the values I desire in the form I am using so the token does appear to be working ok, but yet it returns me an error in the fx area.
Chris
Hello chris
if the IdCar is the name of another field that is in the layer, it is the field I want to use to filter the values, but it keeps returning the maximum value of the KmFin field. it should be in the where class where I have to enter the filter field, but I can't get it to do anything....
I don't get an error in the fx once I paste the token, which provokes a question: Every time I start the survey, do I have to paste the token in the fx for the script to work, or does the program itself update the token once it has been entered?
Greetings javier
Hi Javier,
The statisticType":"MAX will return the highest value on the named field (KmFin). There is no filtering in the function.
There may be another way but I would filter on a second field by bringing it into your function on the xls form e.g pulldata("@javascript", "functions.js", "NameOfFunction", ${token}, ${SecondField})
This would be brought into the function as an argument eg. function NameOfFunction (token, SecondField) {
Then you would need to know how to filter using JavaScript in the function.
The token does not need to be manually entered, it passes through automatically
Chris