1 Reply Latest reply: Apr 6, 2013 2:40 AM by Kiran V RSS

    Dealing with errors from a webservice

      Hi all,

       

      I am trying to construct a webservice load statement using a http request string that returns either a csv table or xml. Due to the large amounts of data that is being returned, the server is timing out and the load is failing.

       

      However in the api call I can input a date range - so I decided to try running the query using a series of incremental 2 week periods. This works fine when there is data present,limiting the data returned to more managebale chunks, but when there is no data for the time period the server returns a no data present error and the load freezes.

       

      Is there a way of dealing with this error?  Maybe like a time out to push on to cancel the http call and then move on to the next?

       

      Heres my code - you can see I tried the set ErroroMode, but thats not helping.

       

      Any help gratefully recieved.

       

      Mark..

       

       

       

      set ErrorMode  =0;



      // Create initial table to load data to

      DATA_TABLE:

      LOAD *,

          
      Date#('2013-03-19', 'YYYY-MM-DD') as Date_Extracted

      FROM

      [http://....&filterIds=7&parameters1=2012-09-14&parameters2=2013-03-18]

      (
      txt, codepage is 1252, embedded labels, delimiter is ',', msq);







      //Set start load date and number of iterations

      let Date1= Num(Date#('2012-09-21', 'YYYY-MM-DD'));

      let weeks = 12;





      //Start looping

      for i=0 to $(weeks)



      //Amend date variable with iteration

      let date1= $(Date1) + 28*$(i);

      let date2= $(date1) + 28;



      // format date variable to work in http call

      let date4=Date($(date1));

      let date5=Date($(date2));





      //load next iteration

      Concatenate (DATA_TABLE) LOAD *,

          
      $(date4) &'-'& $(date5) as Date_range

      FROM

      [http://.....&filterIds=7&parameters1=$(date4)&parameters2=$(date5)]

      (
      txt, codepage is 1252, embedded labels, delimiter is ',', msq);



      //end loop

      NEXT





      //Store to qvd

      STORE * from DATA_TABLE into DATA_TABLE.qvd;