Avatar

Not applicable

Sorry for the bad description, hard to explain what I'm trying to do...I'm trying to combine the data in several fields into another text field.

For example:

Field.DropDown1

Field.DropDown2

Field.DropDown3

In another text field under calculate I have a script that says:

this.rawValue = "Make-" + Field.DropDown1.rawValue + " Model-" + Field.DropDown2.rawValue + " Year-" + Field.DropDown3.rawValue  <- this works great

Where i'm struggline is how can I vary whats included based on an if statement? So say I only wanted to return the rawValue if the field has a value I want?

this.rawValue = "Make-" + Field.DropDown1.rawValue + if(Field.DropDown2.rawValue !=null) {"Model" + DropDown2.rawValue} + if(Field.DropDown3.rawValue != null) {"Year" + Field.DropDown3.rawValue

This is purely an example, I know my syntax with the IF function above is really bad, i'm not sure how to write this properly. In my actual form i've got about 10 check boxes the user completes. Each check has bindings to something more intuitive than a "Yes/No"... what i'm doing is trying to pull out the selections that are selected and put data into the text field as appropriate.

So bascially how can I add an IF in the midde of my expression without breaking it?

Thanks!