I'm trying to dump text files for use in our business intelligence software and, rather than modifying the program for each new table they want added, would like to import the list of tables to a temp table and run from there. I dumped all the tables in the database to a csv and had our Network Administrator put a "Y" next to each table he wanted dumped in column B. What I will do is import them into a temp table and run as such:
Obviously the temp table would be populated from a csv import statement, I just didn't want to fill more space where it wasn't needed. The problem I have is I would like to populate a FOR EACH statement with the sysTables.tablename value as follows:
I have never used dynamic queries so this is proving somewhat difficult for me to learn out of the gate. I saw a &scoped-define function which I haven't used much but I wasn't sure if that would work or not? Any help is greatly appreciated.
Thanks!
Code:
DEF TEMP-TABLE sysTables
FIELD tablename AS CHAR
FIELD toberun AS CHAR.
FOR EACH sysTables WHERE sysTables.toberun = "Y":
/*Run Loop for Dump of Selected Tables*/
END.
Obviously the temp table would be populated from a csv import statement, I just didn't want to fill more space where it wasn't needed. The problem I have is I would like to populate a FOR EACH statement with the sysTables.tablename value as follows:
Code:
DEF VAR cTable AS CHAR.
cTable = sysTables.tablename.
FOR EACH {&cTable} NO-LOCK:
EXPORT DELIMITER ","
/*dump each field of cTable in DB Symix*/
END.
I have never used dynamic queries so this is proving somewhat difficult for me to learn out of the gate. I saw a &scoped-define function which I haven't used much but I wasn't sure if that would work or not? Any help is greatly appreciated.
Thanks!