So I have a survey for logging workers hours, users enter start and end time and it calculates total hours worked (field type double) and saves to feature layer.
I am hoping to have a notation on this survey form that will query the feature layer, and show the total hours worked by said worker. is this type of functionality available, or have I gone outside of the bounds of survey123?
Note: I have plans on creating a dashboard for the supervisors to view this information, but I thought a notation in the survey form would be great instant feedback to the submitter.
Survey XLS attached, extract pasted here.
type | name | label | calculation |
dateTime | shift_start | Start | |
dateTime | shift_end | End | |
calculate | time_worked | Time Worked | round((decimal-date-time(${shift_end}) - decimal-date-time(${shift_start})) * 24,3) |
hidden | temporary_field | Adding all hours together in a calculation. | sum(${time_worked}) |
note | notation | Grand Total Hours Worked ${temporary_field} |
Solved! Go to Solution.
Hi Ben Van Kesteren. I think you could do this with the pulldata() function and a custom JavaScript function within your XLSForm. Have a look at the Early Adopter Documentation we have for this. Keep in mind that at this moment custom JS functions with pulldata only work in the field app and while a user is logged-in.
Look at the sample that shows how to do queries through the REST API. It will show you the basic technique you need to get from the server the total hours worked so far so you can terminate the calculation in the form and show the result in a note question.
Since custom JS functions are not yet supported officially, please use the Early Adopter forum if you have additional questions on this particular capability.
Hi Ben Van Kesteren. I think you could do this with the pulldata() function and a custom JavaScript function within your XLSForm. Have a look at the Early Adopter Documentation we have for this. Keep in mind that at this moment custom JS functions with pulldata only work in the field app and while a user is logged-in.
Look at the sample that shows how to do queries through the REST API. It will show you the basic technique you need to get from the server the total hours worked so far so you can terminate the calculation in the form and show the result in a note question.
Since custom JS functions are not yet supported officially, please use the Early Adopter forum if you have additional questions on this particular capability.
Thanks Ismael, I will do that.
Cheers