Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

For each loop on a field

Hello

I have to tables

ona that is calendar and  another one that we have to load from a website page , the website  page  has Three paramaters (Year, Month, day),

I'll have to loop on year then month than day to get the informations that i want from the website page

how can I do that (for each ?)

2 Replies
luciancotea
Specialist
Specialist

Let's say you have CALENDAR table with YEAR, MONTH, DAY fields.

1.Add a counter field (DAYID) to your CALENDAR TABLE using RowNo()

2. Get the max(DAYID) in a variable VMAX using Peek()

3. For J = 1 to VMAX

  a. select in a temp table the row where DAYID = J

  b. Using PEEK() extract YEAR, MONTH and DAY into variables y,m and d

  c. Select into DUMP_TABLE from your web page where year = y and month = m and day = d

NEXT J

swuehl
MVP
MVP

The other way round would be to create your year, month and day loops, load the data from the website and add a date field to link to your calendar:

For vYear = 2012 to 2013

    For vMonth = 1 to 12

   

    Let vNumDays = day(monthend(MakeDate(vYear,vMonth)));

        For vDay = 1 to vNumDays

       

            TRACE $(vYear) $(vMonth) $(vDay);

             LOAD

                    makedate($(vYear),$(vMonth),$(vDay)) as LinkCalendarDate,

                     ...

               FROM YourWebsite;

           

        Next vDay

    Next vMonth

Next vYear