Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Apply Map and looping load

I have a table with common field names stored at different locations like:

www.abc.com/alpha.html

www.abc.com/beta.html

www.abc.com/gamma.html

www.abc.com/delta.html

there are about 110 such links.

I also have a table as follows

                                       A          B

1

alpha

2

beta

3

gamma

4

delta

I want to use the loop function like for i = 1 to 110

next;

like

for i = 1 to 110

Load *,

From

www.abc.com/$(i).html;

next

How do I use Apply Map (or any other function) in the load script so that it can read the correct link and loop the load?

1 Solution

Accepted Solutions
Marcio_Campestrini
Specialist
Specialist

Hi Rahul

Try something like this:

URL:

LOAD * INLINE [

    id, pagina

    1, alpha

    2, beta

    3, gamma

];

Let noRows = NoOfRows('URL') - 1;

For i = 0 To $(noRows)

  LET vPagina = Peek('pagina', $(i), 'URL');

  LET vURL = 'www.abc.com/$(vPagina)';

  Trace $(vURL);

Next i

The result is:

www.abc.com/alpha

www.abc.com/beta

www.abc.com/gamma

Márcio Rodrigo Campestrini

View solution in original post

6 Replies
Anonymous
Not applicable
Author

can you specify what for you need the applymap?

what do you load from the links? how is the structure of the data to load?

Not applicable
Author

Sorry my question was not clear.

Well the link contains data in a table format. Which is exactly how I need,

so that part is not a problem.

I can actually run the following script and get the desired result.

Test:

Load *

From

(www.abc.com/alpha.html);

Load *

From

(www.abc.com/beta.html);

Load *

From

(www.abc.com/gamma.html)

Load *

From

(www.abc.com/delta.html);

so on and so forth and it suffices my need.

The problem is there are about 110 such links and hence I will have to add

so many lines of code, I am therefore looking at a sleek code maybe a

Looping script (likeFor i = 1 to 110 next) which will reduce this effort.

I was trying to understand if I can use an ApplyMap to assist in this loop.

Please let me know if you have any questions.

On Fri, Aug 29, 2014 at 12:35 PM, Rudolf Linder <qcwebmaster@qlikview.com>

Anonymous
Not applicable
Author

I never worked with html files

but can you do

load

*

from (www.abc.com/*.html)

This way i loadedan loaded several qvds at once in my project

load *

from test????.qvd (as I expect 4 characters after test)

Not applicable
Author

Thanks for your reply but that is not working. Gives an error, maybe it is

not able to understand the * wild charachter there?

I Even tried % but no fruits.

On Fri, Aug 29, 2014 at 7:06 AM, Rudolf Linder <qcwebmaster@qlikview.com>

Marcio_Campestrini
Specialist
Specialist

Hi Rahul

Try something like this:

URL:

LOAD * INLINE [

    id, pagina

    1, alpha

    2, beta

    3, gamma

];

Let noRows = NoOfRows('URL') - 1;

For i = 0 To $(noRows)

  LET vPagina = Peek('pagina', $(i), 'URL');

  LET vURL = 'www.abc.com/$(vPagina)';

  Trace $(vURL);

Next i

The result is:

www.abc.com/alpha

www.abc.com/beta

www.abc.com/gamma

Márcio Rodrigo Campestrini
Not applicable
Author

Awesome it works, I changed it a little at the end

For i = 0 To $(noRows)

  LET vPagina = Peek('pagina', $(i), 'URL');

  Load *

From 'www.abc.com/$(vPagina)'.html;

and it works. Thanks for your help!!!