Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am using the code below to get the stats, it comes up as syntax error, I am unable to figure out why, your help is much appreciated.
SUB Stats;
LET vEndTime = Now();
LET vRecords = NoOfRows('$(vTable)');
LET vFields = NoOfFields('$(vTable)');
Statistics:
LOAD * From Statistics.QVD; //where TableName <> '$(vTable)';
Join (Statistics)
LOAD
DISTINCT
‘$(vTable)’ AS TableName,
‘$(vStartTime)’ AS StartTime,
‘$(vEndTime)’ AS EndTime,
'$(vRecords)' AS Records,
'$(vFields)' as Fields
RESIDENT Statistics;
STORE Statistics INTO Statistics.qvd;
DROP TABLE Statistics;
End SUB ;
Hi,
Your quotation marks are strange
the first 3 lines
‘$(vTable)’ AS TableName,
‘$(vStartTime)’ AS StartTime,
‘$(vEndTime)’ AS EndTime,
Have different quotation marks as to
'$(vRecords)' AS Records,
'$(vFields)' as Fields
Try replacing the second load with this:
LOAD
DISTINCT
'$(vTable)' AS TableName,
'$(vStartTime)' AS StartTime,
'$(vEndTime)' AS EndTime,
'$(vRecords)' AS Records,
'$(vFields)' as Fields
RESIDENT Statistics;
Felipe
What is the error you are getting can you post screen shot of that error?
It seems correct, remove Termination symbol after Stats and try
SUB Stats
LET vEndTime = Now();
LET vRecords = NoOfRows('$(vTable)');
LET vFields = NoOfFields('$(vTable)');
Statistics:
LOAD * From Statistics.QVD; //where TableName <> '$(vTable)';
Join (Statistics)
LOAD
DISTINCT
‘$(vTable)’ AS TableName,
‘$(vStartTime)’ AS StartTime,
‘$(vEndTime)’ AS EndTime,
'$(vRecords)' AS Records,
'$(vFields)' as Fields
RESIDENT Statistics;
STORE Statistics INTO Statistics.qvd;
DROP TABLE Statistics;
End SUB ;
Hi,
Your quotation marks are strange
the first 3 lines
‘$(vTable)’ AS TableName,
‘$(vStartTime)’ AS StartTime,
‘$(vEndTime)’ AS EndTime,
Have different quotation marks as to
'$(vRecords)' AS Records,
'$(vFields)' as Fields
Try replacing the second load with this:
LOAD
DISTINCT
'$(vTable)' AS TableName,
'$(vStartTime)' AS StartTime,
'$(vEndTime)' AS EndTime,
'$(vRecords)' AS Records,
'$(vFields)' as Fields
RESIDENT Statistics;
Felipe
See the attached sample subroutine you can apply this way in your table
Fact:
Load * Inline [
KeyNames
A_Key
B_Key
C_Key
];
LET vTable = 'Fact';
SUB Stats
LET vEndTime = Now();
LET vRecords = NoOfRows('$(vTable)');
LET vFields = NoOfFields('$(vTable)');
Statistics:
Load * Inline
[
ColumnA
‘$(vEndTime)’
'$(vRecords)'
'$(vFields)'
];
STORE Statistics INTO Statistics.qvd;
//DROP TABLE Statistics;
End SUB;
//Calling Subroutine Here
CALL Stats
Thanks Anand.
Thanks Felipe, it worked!
After I load the data, I get an additional column (column 1) which is not part of the table structure, how is it inserted and how can I delete it?
I would assume its coming from this
// Probably a field in there that is loading the 1st column and as you join its perpetuated
LOAD * From Statistics.QVD; //where TableName <> '$(vTable)';
Join (Statistics)
Just comment the above lines and you'll be good to go.
Felipe.
This is the script for Statistics, there is nothing else that I am adding to the table.
Statistics:
LOAD * Inline
[TableName, Source, ReloadedDate, StartTime, EndTime, Duration, Records, Fields];
Store Statistics into Statistics.QVD;
DROP Table Statistics;