2 Replies Latest reply: Aug 20, 2017 2:35 PM by Sasidhar Parupudi RSS

    Exit for when condition is met

    Claudio Bueno

      Hi guys,

       

      I'm loading n xml files into QV and searching for a string (which is in an auxiliary table) in a field from these xml.

      The problem is that I need to stop searching for the string when I first find it, which would be something like 'exit for', and jump to the next file. Any ideas?

       

      Tried  EXIT FOR when Len(nr_liq)>0 but no luck

       

      Thanks!

       

       

      LET NumRows=NoOfRows('Criteria');

       

      FOR each FILE in filelist (Root&'\*.xml')

      FOR i=0 to $(NumRows)-1

       

      LET vTexto=Peek('TEXTO',$(i),'Criteria');

      LET vCaract=Peek('CARACT',$(i),'Criteria');

       

      xml:

      //NFe_mod1:

      LOAD

        Trim(Replace(Mid([NFe/infNFe/infAdic/infCpl],Index([NFe/infNFe/infAdic/infCpl],'$(vTexto)'),$(vCaract)),'$(vTexto)','')) as nr_liq,

        Num(replace([NFe/infNFe/total/ICMSTot/vNF],'.',','),'#.##0,##') as vlr_xml0,

        [NFe/infNFe/emit/CNPJ] as CNPJ,

        FileName([FILE]) as nome_arquivo

       

      FROM [$(FILE)](XmlSimple, Table is [nfeProc])

      WHERE Index([NFe/infNFe/infAdic/infCpl],'$(vTexto)')<>0;

       

      //NFe_mod2:

      LOAD

          Trim(Replace(Mid([infNFe/infAdic/infCpl],Index([infNFe/infAdic/infCpl],'$(vTexto)'),$(vCaract)),'$(vTexto)','')) as nr_liq,

          Num(replace([infNFe/total/ICMSTot/vNF],'.',','),'#.##0,##') as vlr_xml0,

          [infNFe/emit/CNPJ] as CNPJ,

          FileName([FILE]) as nome_arquivo

        

      FROM [$(FILE)](XmlSimple, Table is [Nfe])

      WHERE Index([infNFe/infAdic/infCpl],'$(vTexto)')<>0;

       

      ****Exit For would be here*****

       

      NEXT

      NEXT FILE