As mentioned originally, I want both fields to display and store a number. I just want a select_one to choose which field the user types in and which field officiates the calculation.
If I choose that I want it to calculate the rate, I would choose Rate on the select_one, enter the Amount and let it calculate the Rate. In return, If I choose I want it to calculate the amount, I would select Amount ,enter the Rate and let it calculate the Amount. I want both of those numbers, despite which way was chosen, to be stored within those fields.
The problem that I perceive happening is this (endless loop, division of 0, limit to survey123 capabilities? I honestly have no idea.):
I treat 20 acres. So Acres=20
I weigh my bag and decide I want to calculate by Amount. So, I choose 'amount' on the select_one and enter the amount (lets say 10 pounds) in the amount field.
Acres = 20
Amount = 10
Now, the Rate field becomes read only and attempts to trigger the following: if(selected(${RateOrAmount}, 'Amount'), ${Amount} div ${Acres}, 0) which results in 0.5.
Acres = 20
Amount = 10
Rate = 0.5
However, there is still code that hasn't run, namely the Amount field calculation, which is: if(selected(${RateOrAmount}, 'Rate'), ${Rate} * ${Acres}, 0) which results as a 0.
Acres = 20
Amount = 0
Rate = 0.5
But wait, something has changed within the form, so re run the code:
Now, the Rate field becomes read only and attempts to trigger the following:
Rate field = if(selected(${RateOrAmount}, 'Amount'), ${Amount} div ${Acres}, 0) which results in Not possible.
Amount field = if(selected(${RateOrAmount}, 'Rate'), ${Rate} * ${Acres}, 0) which results as a 0.
Acres = 20
Amount = 0
Rate = Not possible
In reverse, lets say I choose rate (10):
Acres = 20
Amount = 0
Rate = 10
Rate field = if(selected(${RateOrAmount}, 'Amount'), ${Amount} div ${Acres}, 0) which results in 0.
Amount field = if(selected(${RateOrAmount}, 'Rate'), ${Rate} * ${Acres}, 0) which results as a 200.
Acres= 20
Amount = 200
Rate = 0
But wait, something changed:
Rate field = if(selected(${RateOrAmount}, 'Amount'), ${Amount} div ${Acres}, 0) which results in 0.
Amount field = if(selected(${RateOrAmount}, 'Rate'), ${Rate} * ${Acres}, 0) which results as a 0.
Acres = 20
Amount = 0
Rate = 0
Even then, it probably recognizes there was a change and begins a loop of putting 0's into the fields, as the calculation says something must be placed in there at that moment if that calculation runs. If this (trigger) than X (20), otherwise Y (0). Something is always being put into the field every time it runs, even if it is the same number.
I am wanting to bypass the 'else' portion, so that it isn't always putting something in the field (making it less trigger happy). Or set it up so that I can achieve the same results of both fields showing and storing its associated content and it being able to calculate the direction the user chooses.
It is possible I might be able to use your suggestion for a kind of bait and switch behind the scenes that gives the same appearance and effects, but just has a extra steps of moving numbers across fields and creative validating (through If/Then's) to get the results I want. I was just hoping that there is an easier solution before I begin creating a Rube Goldberg Machine to accomplish, what I am still hoping is, a simple set of results.