Page 1 of 1

if then else

Posted: Fri Aug 09, 2013 11:35 pm
by ThomasBodetti
I have a stack that posts to a webserver and receives a result, if the result is OK:0 it means that the post connected but no action was taken, in that case I would want to exit to top with a message, letting the user know that something went wrong.

Code: Select all

 if fld "result1" contains "OK:0" then exit to top with answer "No messages were sent if using topics check spelling" 
I get an error, I know back a few years ago you used to be able to exit with message, but I dont see any docs on that or I missed it.

When everything goes Ok, then a normal result would be something like this, OK:145 or OK:458 up to 1000

I could use ":" as a delimiter, and run the second term and out put it as number of actions taken, but if its OK:0 then I need to stop the script from running, and tell the user some message.

Any thoughts or suggestions are welcomed and appreciated

Re: if then else

Posted: Sat Aug 10, 2013 12:32 am
by FourthWorld
I'm not familiar with an option to send a message with "exit" (though it would be handy). But you can do what you need by breaking it into two lines:

Code: Select all

if fld "result1" contains "OK:0" then
   answer "No messages were sent if using topics check spelling" 
   exit to top
end if

Re: if then else

Posted: Sat Aug 10, 2013 12:39 am
by ThomasBodetti
Ok, yes, thanks, I had an old script I think back around 2.8.1

But its probably been changed years ago, yes, it would be handy, I used to use it to communicate an error, for a validation of a PHP script, but its been a long time since I have fooled with the engine at all.

The docs dont seem to be current with the latest version, I guess I need to read some more on this.

Thanks for the reply, )

Re: if then else

Posted: Sat Aug 10, 2013 12:43 am
by FourthWorld
ThomasBodetti wrote:The docs dont seem to be current with the latest version, I guess I need to read some more on this.
I reviewed the Dictionary entry for "exit to top" before replying, and they seem to be current in that there's no mention of being able to use an additional command, consistent with the engine's having thrown an error when you tried.

What did you find inconsistent in the Dictionary vs. current engine behavior?

Re: if then else

Posted: Sat Aug 10, 2013 3:34 am
by reelstuff
I sort of agree, on how the documentation is done like a cookie cutter template, when it should be more explanative.

Not inconsistant just light on common usage, the docs seem to have a consistent theme of providing less than useful information.

for example in 6.0.2 dictionary, but I do see some new data in there so they must be up to making some changes, it just seems like every time I look at the docs, there are no useful objective information, I know there is no comparison, but when I need to look up a PHP function, I can get all the information I need to make it happen, but this dictionary thing is like reading stereo instructions in braille.

Snip, bad example, but does demonstrate that some of the stuff in the dictionary and in the PDF are old and out of date, but I do think that if LC would update the documentation with an industry standard approach marketing this product would become much more easy.

just saying.

Re: if then else

Posted: Sat Aug 10, 2013 5:07 am
by FourthWorld
The userModify property seems another fairly good example for RunRev: it's HyperCard-specific, has no functional purpose in LC, I've never seen anyone even attempt to use it in my 15 years with LC, and yet they provided it for the benefit of a handful of people porting old HyperCard stacks and documented it far more thoroughly than anyone I know has ever needed. :)

Were you looking for info on tokens related to modifiability of stacks?