IF statement with two outcomes

Avatar

Avatar
Validate 1
Level 3
lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

Correct reply

13 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

Correct reply

13 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
lateniteNC
Level 3

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
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_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
Validate 1
Level 3
lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

Correct reply

13 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

Correct reply

13 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
lateniteNC
Level 3

10-12-2015

Bruce:

Thanks. That worked.

Avatar

Avatar
Validate 1
Level 3
lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

Correct reply

13 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

Correct reply

13 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
lateniteNC
Level 3

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
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_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
Validate 1
Level 3
lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

Correct reply

13 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

Correct reply

13 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
lateniteNC
Level 3

09-12-2015

Forget that post.

Use this as the link:

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

Avatar

Avatar
Validate 1
Level 3
lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

Correct reply

13 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

Correct reply

13 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
lateniteNC
Level 3

09-12-2015

Bruce:

Thanks. Here is the link:

Dropbox - Untitled3.pdf

Avatar

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_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