0 Replies Latest reply: Apr 20, 2015 8:51 AM by Priya R RSS

    For Next Execution

    Priya R

      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)';