IF statement with two outcomes

Avatar

Avatar

lateniteNC

Avatar

lateniteNC

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)

Avatar

Avatar

_Bruce_Robertson

MVP

Avatar

_Bruce_Robertson

MVP

_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)

Avatar

Avatar

lateniteNC

Avatar

lateniteNC

lateniteNC

10-12-2015

Bruce:

Thanks. That worked.

Avatar

Avatar

lateniteNC

Avatar

lateniteNC

lateniteNC

10-12-2015

Bruce:

When I open your updated version, the value in PreBid4 is the word visible rather than the word yes.

Any thoughts?

Avatar

Avatar

_Bruce_Robertson

MVP

Avatar

_Bruce_Robertson

MVP

_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

Avatar

Avatar

lateniteNC

Avatar

lateniteNC

lateniteNC

09-12-2015

Forget that post.

Use this as the link:

https://www.dropbox.com/s/2i151zjz917p1zc/Untitled3.pdf?dl=0

Avatar

Avatar

lateniteNC

Avatar

lateniteNC

lateniteNC

09-12-2015

Bruce:

Thanks. Here is the link:

Dropbox - Untitled3.pdf

Avatar

Avatar

_Bruce_Robertson

MVP

Avatar

_Bruce_Robertson

MVP

_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