Page 2 of 2

Re: Multiple Conditionals on if statement?

Posted: Wed Feb 12, 2020 10:57 pm
by dunbarx
This harkens all the way back to HC, which vacillated between considering it a feature that an unquoted literal, would, eventually, as Klaus mentioned, be resolved into a, er, literal, or, a mild no-no.

It is a terrible idea. I like to see my literals as literals, so I do not confuse them with variables. Quotes do that trick so nicely. Even I can manage that level of discipline.

Craig

Re: Multiple Conditionals on if statement?

Posted: Wed Feb 12, 2020 11:28 pm
by bogs
Hee hee, that sounds like you are being so darned literal :mrgreen:

(I owe you a steak for that one, I think I hit a new low in the cornpone that should go nicely with steak) :D

Re: Multiple Conditionals on if statement?

Posted: Thu Feb 13, 2020 8:18 pm
by SparkOut
I agree, everyone should always quote literals properly. It's not just sloppy code otherwise, it is prone to failure (as it should be).

Re: Multiple Conditionals on if statement?

Posted: Thu Feb 13, 2020 8:26 pm
by dunbarx
What Sparkout said.

Way, way back, because I thought it more compact for some reason, I used both quoted literals and also the same string for control names. These were usually related. There was a small benefit for me, keeping similar stuff in much the same place in a handler.

Don't.

Craig

Re: Multiple Conditionals on if statement?

Posted: Thu Feb 13, 2020 9:05 pm
by bogs
Just so there is no question about it, I am of the same mind despite any bad jokes I might spin about it.

There is still something funny going on in poor JackieBlue1970's case which is not what they think it is.

Re: Multiple Conditionals on if statement?

Posted: Thu Feb 13, 2020 9:20 pm
by dunbarx
JackieBlue1970 says that:
instead of if "Fld1" is empty...
implying that works as he wanted. It cannot work at all.

This is OK:

Code: Select all

if "" is empty then answer "What did you expect?"
but this, nope:

Code: Select all

if "empty" is empty then answer ""Well, what did you expect?"
This last is simpler to grok than the snippet at the top, which is structurally similar. "Fld 1", in quotes, can not and does not reference a field.

That dog don't hunt.

Craig

Re: Multiple Conditionals on if statement?

Posted: Sat Feb 15, 2020 4:50 pm
by JackieBlue1970
bogs wrote: Wed Feb 12, 2020 9:33 pm
JackieBlue1970 wrote: Wed Feb 12, 2020 9:21 pm If field "Fld1" is empty and field "Fld2" is empty then

instead of if "Fld1" is empty...
I don't think that is the issue, JackieBlue1970 :|

Field is indeed a keyword, it identifies the object you are testing, in this case field "fld1" and field "fld2". I modified the stack I posted above to include the wording because that is exactly how you should be referring to controls/objects, and it works here after I named my fields "fld1" and "fld2".

If it wouldn't be asking too much, could you possibly post the code you had before the changes you made? I, and I'm sure many others, would love to take a look at what was going on that was causing the original problem.
aPic_field1-2.png
I tested both ways multiple times. I’ll try to get the code next week. This is just a side project for my business and I only work on it occasionally in the afternoon.

Re: Multiple Conditionals on if statement?

Posted: Sat Feb 15, 2020 5:01 pm
by bogs
JackieBlue1970 wrote: Sat Feb 15, 2020 4:50 pm I’ll try to get the code next week. This is just a side project for my business and I only work on it occasionally in the afternoon.
Sounds good, I'm sure that the problem could be found in short order :D

Re: Multiple Conditionals on if statement?

Posted: Mon Feb 17, 2020 2:37 am
by JackieBlue1970
bogs wrote: Wed Feb 12, 2020 10:13 pm All of which are very good reasons to always quote the name, now we need to find out what is happening in poor JackieBlue1970's case :wink:
Well, it is fixed now. I will try to recreate the error when I have time and post here. Thanks again.