Concatenation using put

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jesse
Posts: 205
Joined: Thu Nov 11, 2010 6:32 pm

Concatenation using put

Post by jesse » Thu May 26, 2011 4:30 am

I am attempting to put a SQL query into a variable and append it with a variable called LIMITSETTING.
In case you wonder the purpose of this is to allow me to limit the number of records loaded in a datagrid.
Initially I am loading 100 then I have a button to be clicked to load the next 100, and the next 100, and so on...

but the below code is not working:

Code: Select all

put "SELECT ID,TITLE FROM products  LIMIT " . LimitSetting into tSQL
My final tSQL value should look like this:

SELECT ID,TITLE FROM products LIMIT 0,200
Deving on WinVista Home Prem. SP2 32 bit. Using LiveCode 4.6.1 Pro Build 1392

jesse
Posts: 205
Joined: Thu Nov 11, 2010 6:32 pm

Re: Concatenation using put

Post by jesse » Thu May 26, 2011 4:45 am

Way to easy... I should have just kept trouble shooting. In case anyone missed it at first as well you
simply use a "&" to seperate each variable and place static text in double quotes and enclose it all
in the parenths. Example shown below includes LimitBegin and LimitEnd in my query which allows me to limit
the number of rows shown in a datagrid.

put ("SELECT ID,TITLE FROM products LIMIT " & LimitBegin &","& LimitEnd) into tSQL
Deving on WinVista Home Prem. SP2 32 bit. Using LiveCode 4.6.1 Pro Build 1392

Post Reply