Qlik Community

Qlik Connectors Discussions

Discussion Board for collaboration regarding Qlik Connectors.

Not applicable

Not responding in a loop

Hi,

Qlik VB script ,we are trying to download xml files from URL.

There are more than 10,000 files,from which only 4800 approx files get downloaded and gives error "Qlik not responding in a loop".

We tried downloading buy using VBA and was able to downloadd all files.that means there is no issue in xml files.

We feel its may be related to multiple Instance creation.

Qlik VB script Code:

sub DownloadFile()

  'Get List of documents to download xml files

  ActiveDocument.Reload

  on error resume next

  'Delete Existing XML Files from location

  Set filesys = CreateObject("Scripting.FileSystemObject")

  'if full load then uncomment below line

  filesys.DeleteFile ActiveDocument.Variables("PathToSaveFiles").GetContent.String & "\*.xml"

  '"FileName"

  set val=ActiveDocument.Fields("FileName").GetPossibleValues(ActiveDocument.Variables("iCount").GetContent.String)

  for i=0 to val.Count-1

  Articleno = val.Item(i).Text

     Articleno = Mid(Articleno, InStr(Articleno, "mmsArtNo=") + 9, InStr(Articleno, "&variantNo=") - (InStr(Articleno, "mmsArtNo=") + 9))

     VariantNo = val.Item(i).Text

     VariantNo = Mid(VariantNo, InStr(VariantNo, "&variantNo=") + 11, InStr(VariantNo, "&bundleNo") - (InStr(VariantNo, "&variantNo=") + 11))

     Language = Right(val.Item(i).Text ,2)

    

     BundleNo = val.Item(i).Text

     BundleNo = Mid(BundleNo, InStr(BundleNo, "&bundleNo=") + 10, InStr(BundleNo, "&language=") - (InStr(BundleNo, "&bundleNo=") + 10))

     DOCURL = ActiveDocument.Variables("MainURL").GetContent.String & val.Item(i).Text

    

     ''if delta load then uncomment below line

    'filesys.DeleteFile ActiveDocument.Variables("PathToSaveFiles").GetContent.String & "\" & Articleno & "_" & VariantNo & "_" & BundleNo & "_" & Language & ".xml", 1 ' 1 = no overwrite, 2 = overwrite

    

     Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")

     WinHttpReq.Open "GET", DOCURL, False

     WinHttpReq.send

    

     'DOCURL = WinHttpReq.responseBody

     If WinHttpReq.Status = 200 Then

         Set oStream = CreateObject("ADODB.Stream")

         oStream.Open

         oStream.Type = 1

      

         oStream.Write WinHttpReq.responseBody

         oStream.SaveToFile ActiveDocument.Variables("PathToSaveFiles").GetContent.String & "\" & Articleno & "_" & VariantNo & "_" & BundleNo & "_" & Language & ".xml", 1 ' 1 = no overwrite, 2 = overwrite

         oStream.Close

     End If

  next

End sub

Thank you

Regards,

Deepika

Tags (1)
Community Browser