Is there a way to include/inject variable within TEXT INTO?
Example
Code: Select all
cVar := 'Spain'
TEXT INTO cSql
SELECT * FROM table WHERE country = cVar
ENDTEXT
Code: Select all
cVar := 'Spain'
TEXT INTO cSql
SELECT * FROM table WHERE country = cVar
ENDTEXT
Code: Select all
var := "'Spain'"
TEXT INTO cSQL
select * from table where country = <<var>>
ENDTEXT
Code: Select all
SELECT * FROM table WHERE country = 'Spain'
Code: Select all
SELECT * FROM table WHERE country = <<var>>
fraxzi wrote:
I tried:ps. I have not tested.Code: Select all
var := "'Spain'" TEXT INTO cSQL select * from table where country = <<var>> ENDTEXT
The result should be:but I got:Code: Select all
SELECT * FROM table WHERE country = 'Spain'
Code: Select all
SELECT * FROM table WHERE country = <<var>>
Code: Select all
var := "'Spain'"
TEXT INTO cSQL
select * from table where country = $1
ENDTEXT
cSQL:= Expand( cSQL, Var )
Code: Select all
TEXT INTO cSql
SELECT Column1
FROM myTable
WHERE Column2 = ?
ENDTEXT
nMyVar:=1
cSql := FW_AdoApplyParams( cSql, { nMyVar } )
fraxzi wrote:Hi All,
Is there a way to include/inject variable within TEXT INTO?
ExampleCode: Select all
cVar := 'Spain' TEXT INTO cSql SELECT * FROM table WHERE country = cVar ENDTEXT
Code: Select all
PRIVATE cVar := "'Spain'" // do not declare cVar as local
TEXT INTO cSql
SELECT * FROM table WHERE country = &cVar
ENDTEXT