if or i don't get it
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
if or i don't get it
if fld "user" <> "254" or fld "user" <> "244" then
answer "Invalid user"
else
to to card 2
I know its wrong because it only answers with Invalid user i cant seem to find the correct way to wright this
alternatively how do I check for a user in a user database? was really only trying to use if/or temporarily anyway.
answer "Invalid user"
else
to to card 2
I know its wrong because it only answers with Invalid user i cant seem to find the correct way to wright this
alternatively how do I check for a user in a user database? was really only trying to use if/or temporarily anyway.
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här
Re: if or i don't get it
Hi DavJans (David Janssen a.k.a. "Richard Kimble"? Geez, I am old to know that tv-series
)
Or to make it a bit more understandable:
Best
Klaus

You should use AND here!DavJans wrote:if fld "user" <> "254" or fld "user" <> "244" then
answer "Invalid user"
else
to to card 2
Or to make it a bit more understandable:
Code: Select all
...
if fld "user" = "254" or fld "user" = "244" then
to to card 2
else
answer "Invalid user"
end if
...

What exactly do you want to check?DavJans wrote:alternatively how do I check for a user in a user database? was really only trying to use if/or temporarily anyway.
Best
Klaus
Re: if or i don't get it
Hi,
Do you see what Klaus meant? No matter what you have in fld "user", you will get "Invalid User"
My only reason for posting is to mention the other way to do this, which sometimes is easier to understand, and may help you figure out why your first try failed:
if fld "user" = 244 or fld "user" = 254 then proceedAccordingly
The "or"/"and" switch sends you down a different path. Instead of exiting when the conditions are not met, you proceed when they are. Just a mention.
Craig Newman
Do you see what Klaus meant? No matter what you have in fld "user", you will get "Invalid User"
My only reason for posting is to mention the other way to do this, which sometimes is easier to understand, and may help you figure out why your first try failed:
if fld "user" = 244 or fld "user" = 254 then proceedAccordingly
The "or"/"and" switch sends you down a different path. Instead of exiting when the conditions are not met, you proceed when they are. Just a mention.
Craig Newman
Re: if or i don't get it
Very close, my name is David Jansson (with an o not an e). I also grew p in Sweden, when I moved to the US and introduced myself everyone would say "Like the actor?" its all right though, as I get older less and less people know who David Janssen is
ok, I get it, for now I will replace or with and.
And what I meant was, eventually I will have a bunch of users and it would be annoying to recompile every time I need to and a new user.
So I need to wright something like

ok, I get it, for now I will replace or with and.
And what I meant was, eventually I will have a bunch of users and it would be annoying to recompile every time I need to and a new user.
So I need to wright something like
Code: Select all
if fld "user" is in this list over here or db table
then go to card 2
else...
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här
Re: if or i don't get it
Well, those can be two quite different things.
The first part is the easiest
For the database part, you'd need to do several steps:
connect to the database
issue a sql query against the open database connection
disconnect from the database
see whether the database query returned a valid response
The first part is the easiest
Code: Select all
if fld "user" is among the lines of fld "valid_users" then
#...do something here
end
connect to the database
issue a sql query against the open database connection
disconnect from the database
see whether the database query returned a valid response
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: if or i don't get it
OK, I can do that, already working with about 10 tables in my application so far, I guess I don't really learn in the conventional order of things 

"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här
Re: if or i don't get it
Hi Dave,
OK, in that case just select all possible users from your database and use an identical script like Mark's:
Best
Klaus
DavJans wrote:OK, I can do that, already working with about 10 tables in my application so far, I guess I don't really learn in the conventional order of things

OK, in that case just select all possible users from your database and use an identical script like Mark's:
Code: Select all
...
if fld "user" is among the lines of VariableHoldingSQLResult then
#...do something here
end
...
Klaus