Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I would like to create a simple audit table and store it as a qvd after each running of the application. I would like to store all the table names and a count of rows. I saw $Tables and $Rows. They work great when displaying in the application, but how can I use them with Inline?
thanks for your suggestions and help!
You can use a script like this:
DATAMODEL:
LOAD * INLINE [TABLE#]; // CREATE EMPTY TABLE
FOR t#=1 TO NoOfTables()
tn = TableName(t#-1)
IF tn <> 'DATAMODEL' THEN
nrows = NoOfRows(tn)
fns = ''
FOR f#=1 TO NoOfFields(tn)
fn = FieldName(f#,tn)
fns = fns & '|' & fn
NEXT
fns = Mid(fns,2,Len(fns));
DATAMODEL:
CONCATENATE LOAD // ADD ONE ROW FOR EACH TABLE
$(t#) AS TABLE#,
'$(tn)' AS TABLENAME,
$(nrows) AS ROWS,
'$(fns)' AS FIELDS
AUTOGENERATE 1;
ENDIF
NEXT
DATE = Date(Now(),'YYYY-MM-DD-hh-mm');
STORE DATAMODEL INTO [D:\DATAMODEL_METADATA\DATAMODEL-$(DATE).QVD] (QVD);
DROP TABLE [DATAMODEL];
You can use a script like this:
DATAMODEL:
LOAD * INLINE [TABLE#]; // CREATE EMPTY TABLE
FOR t#=1 TO NoOfTables()
tn = TableName(t#-1)
IF tn <> 'DATAMODEL' THEN
nrows = NoOfRows(tn)
fns = ''
FOR f#=1 TO NoOfFields(tn)
fn = FieldName(f#,tn)
fns = fns & '|' & fn
NEXT
fns = Mid(fns,2,Len(fns));
DATAMODEL:
CONCATENATE LOAD // ADD ONE ROW FOR EACH TABLE
$(t#) AS TABLE#,
'$(tn)' AS TABLENAME,
$(nrows) AS ROWS,
'$(fns)' AS FIELDS
AUTOGENERATE 1;
ENDIF
NEXT
DATE = Date(Now(),'YYYY-MM-DD-hh-mm');
STORE DATAMODEL INTO [D:\DATAMODEL_METADATA\DATAMODEL-$(DATE).QVD] (QVD);
DROP TABLE [DATAMODEL];
Peter
thanks. This gave me what I needed!