[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

RE: [sqr-users] Dynamicly selecting columns




I have some questions about your procedure get-fields:

     What happens when you try to string a variable into itself?

     What happens when you order by a column not mentioned in the query?

Richard Knapp
Database Programmer/Analyst
Institutional Research and Planning
University of Missouri System
573-882-8856
knappr@umsystem.edu


-----Original Message-----
From: R.Oulad@mindef.nl [mailto:R.Oulad@mindef.nl]
Sent: Friday, August 01, 2003 7:09 AM
To: sqr-users@sqrug.org
Subject: [sqr-users] Dynamicly selecting columns


Hallo Sqr gurus,

I have some questions about the following:

I have a file layout containing several records. In my sqr I want to select
dynamicly which records are involved and which records form the File Layout.
I have read in the sqr documentation that it is possible to dynamicly select
one column, but my record defenition consist of several fields. I can't get
it work for more fields. Look at the following code:

begin-procedure get-records

  let $comma = ','

begin-select
FLDSEGNAME

   let $segname = &FLDSEGNAME
   
   let $recname = 'PS_' || $segname
 
   do get-fields
 
FROM PSFLDSEGDEFN
WHERE FLDDEFNNAME = 'PERSON_STG'
end-select

end-procedure !get-records

begin-procedure get-fields

begin-select
FLDFIELDNAME
   let $fieldname = rtrim(ltrim(&FLDFIELDNAME,' '),' ')


   string  $column $fieldname $comma by  '' into  $column

     do select-data

from psfldfielddefn
where flddefnname = 'MVD_PERSON_STG'
and fldsegname = $segname
order by fldseqno
end-select

end-procedure !get-fields


begin-procedure select-data
begin-select

[$column]

from [$TABLE.FLDSEGNAME]
where blabla

end-select
end-procedure

Can anybody help me with this.

Regards,
Redouan


_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users