modify global value from query return

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Location: USA
Contact:

modify global value from query return

Post by reelstuff » Sun Sep 02, 2007 1:01 am

I have a return value from a query.php file, which is basically,
return:true
or
return:false

I was thinking of how to make this a global so that I can call this global, from any card.

but I am a little lost on globals and the documentation, well I just cant seem to get what information is there.

So what I am working on is how to have a global that can change from false to true and back to false
should the code below return false at some point in the future.

So I guess my question is how to modify a global with the result of the query returned.

global myglobal {false|true}
depending on the current status of the field sData

Code: Select all


on mouseUp
   put "http://www.somewebserver/query.php?" into tUrl
   put "r=" into tString
   put FIELD "preceipt" after tString 
   put "&e=" after tString
   put FIELD "pemail" after tString 
   put "&k=" after tString
   put "1ABvuc58kljh" after tString
   post tString to url tUrl
   if the result is empty then
   put it into Field "sData"
   else
   put the result into FIELD "sData"
 end if
 put FIELD SData into it
 if it is "return:true" then go to next card
 else answer "Incorrect code please try again"
end mouseUp

Klaus
Posts: 13878
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Post by Klaus » Sun Sep 02, 2007 11:17 am

Hi reelstuff,

let me see if I get it... :-)

...
global myglobal
If fld "sDate" = "return:true" then
you want to put "true" into myglobal
else
you want to put "false" into myglobal
end if
...
?

If yes then you could adopt my suggestion almost 1:1 ;-)


You could also:
...
global myglobal
put (fld "sDate" contains "true") into myglobal
...

to get the necessary Boolean value :-)

Hope that helps.


Best from germany

Klaus

reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Location: USA
Contact:

Post by reelstuff » Sun Sep 02, 2007 1:05 pm

Yes, thank you I believe I understand it a lot better now.

Post Reply

Return to “Talking LiveCode”