Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
Can some one please explain the below For Next execution process?
COREP_MetaData:
LOAD * From '..\QVDs\EXT_COREP_MetaData.qvd' (qvd);
NoConcatenate
ReportTempTable:
LOAD Distinct
Report as ReportTemp,
ReportEval as ReportEvalTemp
Resident COREP_MetaData where Ready = 'Y' Order By ReportEval;
LET vReportCount = NoOfRows('ReportTempTable');
LET vTotalExpressions = 0;
LET vTotalExpressionsBS = 0;
FOR repCounter = 0 to $(vReportCount)-1
LET vRep = Peek('ReportTemp',$(repCounter),'ReportTempTable');
QUALIFY *;
TempMetaData:
LOAD *
Resident COREP_MetaData where Report = '$(vRep)' and Available <> 'NA' and EvalOrder > 0 and Ready = 'Y' order by EvalOrder;
UNQUALIFY *;
Let vTempDataCount = NoOfRows('TempMetaData');
Trace TempDataCount: $(vTempDataCount);
LET vTempExpression='';
IF('$(vRep)' <> 'BS') then
vTotalExpressions = $(vTotalExpressions) + $(vTempDataCount);
ENDIF
FOR tempCounter = 0 to $(vTempDataCount) - 1
LET vEvalOrder = Peek('TempMetaData.EvalOrder',$(tempCounter),'TempMetaData');
LET vTempExp = Peek('TempMetaData.Expressions',$(tempCounter),'TempMetaData');
LET vTempKey = Peek('TempMetaData.Key',$(tempCounter),'TempMetaData');
IF($(tempCounter) = 0) then
vTempExpression = '$(vTempExp),$(vTempKey)';
ELSEIF($(tempCounter) <> 0) then
vTempExpression = '$(vTempExpression),$(vTempExp),$(vTempKey)';
ENDIF
NEXT
IF('$(vRep)' <> 'BS') then
TempReport:
LOAD
ReportTemp,
ReportEvalTemp,
'$(vTempExpression)' as ReportExpression
Resident ReportTempTable where ReportTemp = '$(vRep)';
ELSE
LET vBSCount = $(vTempDataCount);
BSTempReport:
LOAD
ReportTemp as BSReportTemp,
ReportEvalTemp as BSReportEvalTemp,
'$(vTempExpression)' as BSReportExpression
Resident ReportTempTable where ReportTemp = '$(vRep)';
ENDIF
DROP Table TempMetaData;
NEXT
DROP Table ReportTempTable;
LET vRepCount = NoOfRows('TempReport');
TRACE Total Exp: $(vTotalExpressions);
LET vExpression = '';
FOR vRepCounter = 0 to $(vRepCount) - 1
LET vReport = Peek('ReportTemp',$(vRepCounter),'TempReport');
LET vEx = Peek('ReportExpression',$(vRepCounter),'TempReport');
LET vLen = 0;
IF($(vRepCounter) = 0) then
vExpression ='$(vEx)';
ELSEIF ($(vRepCounter) <> $(vRepCount)-1) then
vExpression = '$(vExpression),$(vEx)';
ELSEIF ($(vRepCounter) = $(vRepCount)-1) then
LET vClose = Repeat(')',$(vTotalExpressions));
vExpression = '$(vExpression),$(vEx)$(vClose)';
ENDIF
NEXT
LET vBSExp = Peek('BSReportExpression',0,'BSTempReport');
vClose = Repeat(')',$(vBSCount));
vBSExp = '$(vBSExp)$(vClose)';
In short: a qvd-file will be loaded, then filtered and sorted and then per nested for-loop row-wise queried whereby the query-results serve as parameter for further statements. If you need to change these script you will need to understand what is does.
For this you should turn on the load-logging to see what will be loaded in which tables/fields with how many records and use the debugger to see what the variables return.
- Marcus
In short: a qvd-file will be loaded, then filtered and sorted and then per nested for-loop row-wise queried whereby the query-results serve as parameter for further statements. If you need to change these script you will need to understand what is does.
For this you should turn on the load-logging to see what will be loaded in which tables/fields with how many records and use the debugger to see what the variables return.
- Marcus