AnsweredAssumed Answered

Survey123 Conditional/Required/ReadOnly/Relavant - Trickery

Question asked by dharwell on Dec 13, 2019
Latest reply on Dec 19, 2019 by dharwell

Hi all S123 users!


I am in need of some xlsforms trickery. I am building a survey for a client trying to replicate an old dinosaur of a desktop application they are using to manage some land assets that has very specific business logic associated with some fields..


There are 2 problematic fields I need a solution for at the moment, a Total_Cost field and a Cost_PerArea field. The application does calculations on the back-end using the area of a polygon feature, and the user must only enter a value for one of these fields and then the other gets calculated. For example, a user could enter the cost per area and then the total cost would get calculated by multiplying the polygon area, or on the flip side a user could enter the total cost and then the cost per area would be calculated by dividing the polygon area. Pretty straightforward. 


So the business logic the survey needs to replicate is:

- both fields visible initially

- one has to be required

- if one gets a value the other must become either read-only or disappear (I can use an if statement in the readonly column for one of the fields, but not both at the same time, I get a broken parser error otherwise I think that would be the solution)


Any help would be greatly appreciated!