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