I'm working on a form that creates a wide range of conditional statements that build from one another over time. To do this, I made a single large table with a range of user-filled options. For the problem cell, I've got a set of if-else statements with five potential outcomes, which are themselves dependent upon another variable from a prior cell. The conditional is as follows:
I've not been able to get any value at all, which must mean there's something wrong with my overall conditional formula, but after several hours of testing and making minute changes and testing again and reviewing these forums, I can't figure out what I'm doing wrong.
A few things of note:
Options 1 - 4 of GeneralTable.Row1.CollarType come from a drop-down list users must choose from before they're even allowed to see the table. This function works as designed and there is no chance one of the options won't be selected.
Ero is a variable defined in an earlier cell which can only be one of two values based on user input: 0 or 1 ("Pass" or "Fail", respectively).
The conditional is located in the exit event of a drop-down box, the contents of which change significantly depending upon which of Options 1 - 4 are selected at the start of the form.
RDB46BPF is a cell that contains the results of an earlier formula in the same drop-down box's exit event. This earlier formula has already been tested and works fine.
At the moment I can only think of two possibilities: either there's something wrong with the AND and OR statements' formatting for Option 4, or the cell is not pulling the value of Ero because it was created and defined in a separate cell. If anyone has any insights that might help me out, I'd appreciate it.
Okay, I'll try to make it simple for you to understand...
First of all, to assign a value to a text field you must use the '=' operator as follows :
To compare values you must use the '==' or '===' operators, both have different behaviour but '==' is the most commonly used.
Now to assign a value to a text field, you must use the rawValue property and the '=' operator and to pull the value from the text field use the rawValue property as well.
So technically in the event which you declare the variable Ero, you should assign the value Ero within the text field.
Once you want to access that value from another event, just make sure to use the right reference syntax to access that text field you have assigned the value in, and pull the value using rawValue property... You can also re-declare the variable Ero in that other event directly to be the rawValue of the hidden text field. See example below :
I hope this will help you to get on the right track.
Oh... OH. All this time I was trying to get the script-defined variables! I had no idea we were talking about pulling rawValues. I do that all the time and it should have been obvious.
On the one hand, this does fly in the face of the original reason I was doing all of this in the first place. That original intention was to create a set of formulae based on variables instead of pulling the long codes of rawValues, hopefully making it easier to follow for whoever comes after me in three or four years to update the form. This method pulls the rawValues, which is exactly what I was trying to avoid.
But if it works, it works. I will make use of this method. Thanks, this solves the problem in its entirety!
Apologies, but I remain confused. While I can make a hidden text field easily enough and create variables within it, the primary problem remains: I don't know how to pull the variable values from that hidden text field (or a script object if I were to use that option) for use/changing in other fields. I had hoped it would be as simple as using "==" and "=" comparisons, but clearly that is not the case, and my help files only refer to variables in terms of script objects (and then without telling me how to use them as I intend to).
In this case it would be simpler to store your value in a hidden textfield.
Either one or the other is good, get set functions are only easy access troughout the whole form and might be of a better use when having many different variables to handle. Usually get set functions are for oriented objects... which is not your case. It was only an option.
Go for the hidden text field, sorry for the confusion.
Hey, Magus, thanks for the help. After reading up on the topic of Get Set functions and Script Objects and doing some experimentation, I'm afraid I'm still no closer to a solution. This is almost certainly because I don't understand get how to call upon and change the object value using a get/set function.