is there and easy way to create a script with a two part if statement? i.e.: if the fruit is "round" (result from shape field) and the color is " orange" (result from color field) then the result to be entered in a result column is "an orange"?
Nested If ( ) steps will do it. This part of your script will look something like this:
If ( shape field = "round" )
If (colour field = "orange" )
do the other
THANK YOU !!!
I trust you grasp the underlying logic. The second If( ) is just the "true" response to the first If( ). Thus you can nest as many as you like, and also use Else If ( ), to extend the logic for further possibilities. I thought afterwards I could have been more specific to help, so:
If ( colour field = "orange" )
do this if round and orange
Else If ( colour field = "green" )
do this if round and green
do this if round and neither orange nor green
do this if not round
If the result needs to be entered into a third column, and if the results are based upon the criteria specified then why not use a calculation for the third column (field) so you do not have to run script?
Shape = "Round" and Color = "Orange" ; "Orange" ;
Shape = "Round" and Color = "Red" ; "Cherry" ;
... enter more values then a final result
If you have very many combinations and/or if you might be changing their name pairs then it would be best to use a table which would probably save you a lot of maintence later. :-)
I feel I should also mention option of using merge variable set in conditional format in place of creating a calculation. I prefer it unless it's a field used in various places or for exporting, searching, calculating, summarizing and such.
And yes you can have Case() or If() within but my point was to use a calc so it is maintenance-free. The only time it would need to be a standard field is if you might need to change the results or set a related table (which is rare). Sorry I'm explaining in segments. I' d like to blame the iPad but can't on this one, LOL
Retrieving data ...