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!

Why is it that I cant have an if statement in both field readonly columns, something like:

if(${Planned_Total_Cost},'','yes')

if(${Planned_Cost_PerArea},'','yes')

And similarly in the required column except with the 'yes','' switched. That would solve the problem I believe. If I use one of those if statements for either total cost or cost per area in both required and readonly fields I can get the desired behavior for the other field, but it seems S123 can't handle both at the same time!

Attached is the error I get which is odd because it mentions two fields, relevant and calculate which I am not using..