I'm using pulldata("@layer") to get a datetime based on another field in the survey and I wish to compare it to another value and show true/false.
so my field "test1" has the pulldata function and "test2" has the pulldata function with a comparison "> 10" at then end, like so: pulldata("@layer", "getValue", "attributes.inspection_date", "service_url/FeatureServer/14?orderbyfields=inspection_date desc", concat("field1 =", ${field1}, " and field2 = '1'")) > 10
in survey123 connect (and android app) I get :
which is correct, but in the web app, I get:
where "test2" should also return "true".
I tried putting int() around my pulldata() but doesn't work. I also tried "field2 = 1" and "field2 = 'yes'", doesn't work either.
What am I doing wrong here?
Thanks!
Solved! Go to Solution.
I guess I didn't explain my problem correctly. Basically I wanted to only show a field if the last inspection date was older than X days (4 in this case). I tried your suggestion @DougBrowning but then my field was a date, which was not what I wanted.
I ended up going back to the old Dates and Time in Survey123 and noticed this:
After plenty of trial and error, I got it working. I had to divide the calculations in multiple fields, for some reason doing it as a one liner didn't work (field3_tf).
type | name | label | appearance | calculation | bind::esri:fieldType | body::esri::visible |
integer | today_ddt | todat_ddt | hidden | decimal-date-time(today()) | null | |
integer | field3_ddt | field3_ddt | hidden | decimal-date-time(int(pulldata("@layer", "getValue", "attributes.inspection_date", "https://service_url/14?orderbyfields=inspection_date desc", concat("field1 =", ${field1}, " and field2 = '1'")))) | null | |
text | field3_tf | field3_tf | hidden | ${today_ddt} - ${field3_ddt} > int(decimal-date-time(4)) | null |
|
select_one blabla | field3 | field 3 | esriFieldTypeInteger | ${field3_tf} = true |
Try setting the bind::type column to date or datetime. That usually does it for numbers so I think it may work for this also. All items in 123 are treated like strings when using calculate unless you set this column. Other newer way is to set the type to date then set appearance to hidden.
Hope that does it
I guess I didn't explain my problem correctly. Basically I wanted to only show a field if the last inspection date was older than X days (4 in this case). I tried your suggestion @DougBrowning but then my field was a date, which was not what I wanted.
I ended up going back to the old Dates and Time in Survey123 and noticed this:
After plenty of trial and error, I got it working. I had to divide the calculations in multiple fields, for some reason doing it as a one liner didn't work (field3_tf).
type | name | label | appearance | calculation | bind::esri:fieldType | body::esri::visible |
integer | today_ddt | todat_ddt | hidden | decimal-date-time(today()) | null | |
integer | field3_ddt | field3_ddt | hidden | decimal-date-time(int(pulldata("@layer", "getValue", "attributes.inspection_date", "https://service_url/14?orderbyfields=inspection_date desc", concat("field1 =", ${field1}, " and field2 = '1'")))) | null | |
text | field3_tf | field3_tf | hidden | ${today_ddt} - ${field3_ddt} > int(decimal-date-time(4)) | null |
|
select_one blabla | field3 | field 3 | esriFieldTypeInteger | ${field3_tf} = true |