Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey guys, I've been trying to do parsing html files automatically, but by now I still can't do it, because of the parsing of the websites.
I have an Inline table with names of websites, and I want to create a loop to parse these websites.
Here's my example code :
Sites :
load * inline [
PageName,
qlik.com
google.com
];
FOR i = 0 TO NoOfRows('Sites') - 1
LET vSite = '"http://www.'&peek('PageName', $(i))&'"';
Web:
LOAD
recno() as Position,
@1:n as Code
FROM $(vSite) (ansi, fix, no labels, record is line);
NEXT i
and I always have parsing errors of the web title while loading, like this :
NOTE :
If I do manually the name of the web, assigning the variable like this :
FOR i = 0 TO NoOfRows('Sites') - 1
LET vSite = 'http://www.qlik.com';
Web:
LOAD
recno() as Position,
@1:n as Code
FROM $(vSite) (ansi, fix, no labels, record is line);
NEXT i
It works fine!!. But I want to do it automatically, and I'm trying to parse the dots, the single quotes, the double quotes, and I still don't get what's happening.
Any help would be appreciated.
Many thanks in advance!!
Hi Marcel, I have experienced the same issue in the past, and I realized that if you add the name on the table within the peek function the error goes away, try this:
Sites :
load * inline [
PageName,
qlik.com
google.com
];
FOR i = 0 TO NoOfRows('Sites') - 1
LET vSite = 'http://www.' & peek('PageName', $(i),'Sites');
Web:
LOAD
recno() as Position,
@1:n as Code
FROM $(vSite) (ansi, fix, no labels, record is line);
NEXT i
Is you next step is parsing the html title label on the sites??, or was it only my imagination??
Regards
Hi Marcel, I have experienced the same issue in the past, and I realized that if you add the name on the table within the peek function the error goes away, try this:
Sites :
load * inline [
PageName,
qlik.com
google.com
];
FOR i = 0 TO NoOfRows('Sites') - 1
LET vSite = 'http://www.' & peek('PageName', $(i),'Sites');
Web:
LOAD
recno() as Position,
@1:n as Code
FROM $(vSite) (ansi, fix, no labels, record is line);
NEXT i
Is you next step is parsing the html title label on the sites??, or was it only my imagination??
Regards
Hi Marcel,
i think that the problem is with using the peek function. Instead of it you may use FieldValue like this:
LET vSite = 'http://www.'&FieldValue('PageName', $(i));
(in the test file that i used it works)
Stefan
Many thanks Ivan, It seems it's a little mistake of Qlikview, because If I'm not wrong, if you not specify the name of the Table, it gets the last table loaded.
Thanks, now it works fine!!
Thanks stefanstoichev,
I've tried your solution, and I don't know why, it didn't work. So I've tried Ivan's solution that works fine.
Thanks anyway and see you around!!