Hello,
I need to do some field value replacements across multiple tables; rather than rewrite the procedure for every table (around 100 of) them, I would like to setup a table with a list of the table name / field name and have a single block of code cycle to through the list. Basically I am looking for construct a select statement with table/field names pulled from a memory variable, but I am at a loss on how to make this work. I tried setting up something like below:
SELECT 1
USE tables
*
GO TOP
tablename=ALLTRIM(table)
fieldname=ALLTRIM(field)
*
DO WHILE .NOT. EOF()
*
DELETE VIEW vexisting
*
CREATE SQL VIEW vexisting;
REMOTE CONNECTION SysProData;
AS SELECT tablename.fieldname FROM tablename;
ORDER BY tablename.fieldname
*
DBSETPROP ("vexisting", "View", "SendUpdates", .T.)
DBSETPROP("vexisting" , "VIEW","WhereType",3)
DBSETPROP("vexisting.StockCode", "Field", "Updatable", .T.)
DBSETPROP("vexisting.StockCode", "Field", "UpdateName", [tablename.fieldname])
Go back from here to check for EOF() on tables and if not skip and populate the memvars with the next record's value.
Can this be made to work?
I will greatly appreciate your assistance.
I need to do some field value replacements across multiple tables; rather than rewrite the procedure for every table (around 100 of) them, I would like to setup a table with a list of the table name / field name and have a single block of code cycle to through the list. Basically I am looking for construct a select statement with table/field names pulled from a memory variable, but I am at a loss on how to make this work. I tried setting up something like below:
SELECT 1
USE tables
*
GO TOP
tablename=ALLTRIM(table)
fieldname=ALLTRIM(field)
*
DO WHILE .NOT. EOF()
*
DELETE VIEW vexisting
*
CREATE SQL VIEW vexisting;
REMOTE CONNECTION SysProData;
AS SELECT tablename.fieldname FROM tablename;
ORDER BY tablename.fieldname
*
DBSETPROP ("vexisting", "View", "SendUpdates", .T.)
DBSETPROP("vexisting" , "VIEW","WhereType",3)
DBSETPROP("vexisting.StockCode", "Field", "Updatable", .T.)
DBSETPROP("vexisting.StockCode", "Field", "UpdateName", [tablename.fieldname])
Go back from here to check for EOF() on tables and if not skip and populate the memvars with the next record's value.
Can this be made to work?
I will greatly appreciate your assistance.