Newbie on Livecode

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

eyonmac
Posts: 12
Joined: Sat May 10, 2014 6:25 pm

Re: Newbie on Livecode

Post by eyonmac » Tue May 13, 2014 7:31 pm

Hello, it's me again ...
Is there a possibility to recover a variable in a SQL command ?
I'd like to do this :

Code: Select all

put "SELECT * from informations WHERE infos LIKE myvariable into tSQL
but I don't know how to write it.
I have created a global variable in my stack and when an item is selected in my option menu, its content goes into myvariable. That works. But I can't find how to recover the content of this variable in the sql command.
Would you have any idea ?
Thanks a lot !

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Newbie on Livecode

Post by Klaus » Tue May 13, 2014 10:01 pm

No idea what you mean with "recover a variable"?

But two things:
1. you do not have any "WILDCARD" in your "LIKE XYZ" statement!
2. I showed you a working example of this on the previous page:
http://forums.runrev.com/phpBB2/viewtop ... 60#p103439
8)

eyonmac
Posts: 12
Joined: Sat May 10, 2014 6:25 pm

Re: Newbie on Livecode

Post by eyonmac » Wed May 14, 2014 6:24 am

Sorry, I wasn't really clear :
instead a word (apb for instance) in the sql request, I'd like to put a variable declared previously. I suppose the writing is different ?
Have I to put put quotes (apostrophe) around the variable : '%myvariable%' ? I have tried with different writings but it does not work.
Thanks a lot Klaus and have a good day

SparkOut
Posts: 2949
Joined: Sun Sep 23, 2007 4:58 pm

Re: Newbie on Livecode

Post by SparkOut » Wed May 14, 2014 11:08 am

Code: Select all

put "SELECT * from informations WHERE infos LIKE" && myvariable into tSQL
or maybe

Code: Select all

put "SELECT * from informations WHERE infos LIKE %" & myvariable & "%" into tSQL
if you haven't already got the wildcard markers in the variable

eyonmac
Posts: 12
Joined: Sat May 10, 2014 6:25 pm

Re: Newbie on Livecode

Post by eyonmac » Wed May 14, 2014 6:44 pm

Thanks a lot SparkOut !
I'm going to try this writing.
Best
Michel

Post Reply