Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
rakesh_kumar
Creator
Creator

Do while iterno() issue

Hi All,

I have a requirement where I have 10 user IDs, each having more than 400 text, I would like to load only 2000 records into 5 QVDs for first 5 user IDs, like 400 for each user and stop there. But the problem is the code was not stopping at 2000 records (5 users) and loading 400 records for each remaining 5 users, creating 10 QVDs and still running.  Please let me know how I can resolve this?

4 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Instead of IterNo() you can vLoopNumber variable like below, Iterno() works only in Load statement

LET vLoopNumber = 1;

Do while vLoopNumber < 2000

  Let vLoopVariable = peek('LoopVariable',vLoopNumber-1,'LoopVariables');

  Twitter_Table:

  First 400 LOAD

     id as UserTimelineid,

     created_at as UserTimelinecreated_at,

     text as UserTimelinetext,

     source as UserTimelinesource  

  FROM

  [http://localhost:5555/QVSource/TwitterConnectorV2/?table=UserTimeline&userName=$(vLoopVariable)&appI...]

  (qvx);

  STORE Twitter_Table into 'QVDs\QVD_$(vLoopVariable).qvd';

  DROP Table Twitter_Table;

  vLoopNumber = vLoopNumber+1;

LOOP

Regards,

Jagan.

rakesh_kumar
Creator
Creator
Author

Hi Jagan,

Thanks for the reply.

Sorry it didn't worked. Your code is working the same way as my original code.

Is there any other way to resolve this issue?

Thanks

PradeepReddy
Specialist II
Specialist II

try by changing the do while condition

"Do while IterNo() < 2000" to 'Do while IterNo() <=5'


Edit:

If I understand correctly, you want to retrieve the first 400 tweets by the user and store them in the QVD. If so, you required 5 iterations only.

jagan
Luminary Alumni
Luminary Alumni

HI,

Instead of do while use while

LET vLoopNumber = 1;

DO while vLoopNumber < 2000

  Let vLoopVariable = peek('LoopVariable',vLoopNumber-1,'LoopVariables');

  Twitter_Table:

  First 400 LOAD

     id as UserTimelineid,

     created_at as UserTimelinecreated_at,

     text as UserTimelinetext,

     source as UserTimelinesource 

  FROM

  [http://localhost:5555/QVSource/TwitterConnectorV2/?table=UserTimeline&userName=$(vLoopVariable)&appI...]

  (qvx);

  STORE Twitter_Table into 'QVDs\QVD_$(vLoopVariable).qvd';

  DROP Table Twitter_Table;

  LET vLoopNumber = vLoopNumber+1;

LOOP



This should work, if not try debugging where you are getting issue.

Regards,

Jagan.