Javier,

True, but I use & religiously to do the spacing as it is easier to see in the 
code.

Dennis McGrath
Software Developer
QMI Security Solutions
1661 Glenlake Ave
Itasca IL 60143
630-980-8461
[email protected]

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Javier Valencia
Sent: Monday, March 17, 2014 1:30 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: concat variables

Dennis,

SET VAR vWhereClause = ('WHERE  ' +  .vReportWhere)
And...
SET VAR vWhereClause = ('WHERE ' &  .vReportWhere)

Will give you the exact same result. R:Base will not strip spaces (blank
after WHERE) in the middle of an expression.

Javier,

Javier Valencia, PE
O: 913-829-0888
H: 913-397-9605
C: 913-915-3137


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Dennis
McGrath
Sent: Monday, March 17, 2014 1:06 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: concat variables

SET VAR vReportWhere = 'Item_Number = 100'
SET VAR vReportName = 'IM_ALL_1'
SET VAR vReportOrderBy = 'Item_Number ASC''

--RBASE strips trailing spaces so use & to put the pieces together SET VAR
vWhereClause = ('WHERE ' &  .vReportWhere) SET VAR vOrderBy = ('ORDER BY '
&  .vReportOrderBy')

PRINT  &vReportName   &vWhereClause  &vOrderBy OPTION SCREEN

When you use and Ampersand instead of a dot in front of a variable, the
exact contents of the variable are read by the interpreter as part of the
command The above syntax looks like the following to the interpreter:

PRINT  IM_ALL_1   WHERE Item_Number = 100  ORDER BY Item_Number ASC OPTION
SCREEN

Trace your command file and watch the variables to see what each one
actually contains.  Errors should become apparent quickly.


Dennis McGrath
Software Developer
QMI Security Solutions
1661 Glenlake Ave
Itasca IL 60143
630-980-8461
[email protected]
From: [email protected] [mailto:[email protected]] On Behalf Of Matthew
Brock
Sent: Monday, March 17, 2014 12:36 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - concat variables

I am trying to print using variables and can not get it to work.
I am sending in variables

SET VAR vReportWhere = 'Item_Number = 100'
SET VAR vReportName = 'IM_ALL_1'
SET VAR vReportOrderBy = 'Item_Number'

Then i set new variables based on the above SET VAR vWhereClause = ' WHERE '
+ .vReportWhere + ' '
SET VAR vOrderBy = ' ORDER BY ' + .vReportOrderBy' + ' ASC '

Then i try and call a PRINT command

PRINT .vReportName .vWhereClause .vOrderBy OPTION SCREEN

I have tried putting + which is not suppose to add a space I have tried
putting & which is suppose to add a space

Still nothing works unless i try
PRINT IM_ALL_1 WHERE Item_Number = 100 ORDER BY Item_Number ASC OPTION
SCREEN

Where is my syntax wrong?

 
Thanks,
Matthew D. Brock


Reply via email to