IF statement with two outcomes

lateniteNC

05-12-2015

I have an issue with an IF statement not producing the desired results; hoping that some of the experts here can readily solve the problem.

I have a series of textboxes (named PreBid1, PreBid2, etc.) that need to be populated with "Yes" and "No" answers AND make visible/invisible a button object. The answers are generated based on the selection of a radio button group.

if(form1.page1.subform1.status.rawValue == "Routine Oversight" || form1.page1.subform1.status.rawValue == "Enhanced Oversight" || form1.page1.subform1.status.rawValue == "Escalated Oversight"){

 

PreBid1.rawValue = "Yes";

Button1.presence = "visible";

}

else {

Button1.presence = "hidden";

PreBid1.rawValue = "";

}

The button's presence is working, but the PreBid1 text field is not populated with "Yes.". If I remove the Button1 statements, the Yes value populates.

I am sure this is simple, but I cannot figure it out.

Accepted Solutions (1)

Accepted Solutions (1)

_Bruce_Robertson

MVP

10-12-2015

You need to swap the order of the lines

PreBid4.rawValue = "Yes";

Button1.presence = "visible";

to


Button1.presence = "visible";

PreBid4.rawValue = "Yes";

In the calculate event it is the last expression evaluated that is returned (so presence = "visible")

Regards

Bruce

Answers (6)

Answers (6)

_Bruce_Robertson

MVP

10-12-2015

Hi,

Not sure I'm looking at the right thing, the code in PreBid4 looks like the above code but doesn't have the braces around the else statements ... looks like you have been trying lots of different code.

I've added those and it seems to be working https://sites.google.com/site/livecycledesignercookbooks/home/Untitled3.updated.pdf?attredirects=0&d...

Regards

Bruce

_Bruce_Robertson

MVP

08-12-2015

Hi,

Your code looks ok.  Happy to have a look at your form if you can share it.  Upload it to Google Docs, Dropbox, or whatever and post a link to it here.

Regards

Bruce