Discussion Board for collaboration related to QlikView App Development.
Hi guys,
I need to loop over the values in the field "DB" from table "Databases".
I am trying the code below, but it is not working.
How can I work it around?
Thanks in advance,
Aldo.
Databases:
LOAD App,
DB
FROM
..\Excel\Databases.xls
(biff, embedded labels, table is Databases$);
FOR EACH ROW In ($(DB))
FOR EACH TB In 'PART'
$(TB): SQL SELECT * FROM $(ROW).dbo.$(TB);
//Store into QVD files.
STORE $(TB) INTO $(rawDataPath)$(TB)-$(ROW)-PRI.qvd
(qvd);
//Drop tables
DROP TABLE $(TB);
NEXT
NEXT
The script below seems to be working.
Aldo.
//List of Databases
Databases:
LOAD App,
DB
FROM
..\Excel\Databases.xls
(biff, embedded labels, table is Databases$)
WHERE(App = 'Priority');
LET currField = 'DB';
LET rowNo = 1;
DO WHILE rowNo < FieldValueCount('$(currField)');
LET database = FieldValue('$(currField)', $(rowNo));
FOR EACH TB In 'CUSTOMERS'
$(TB): SQL SELECT * FROM $(database).dbo.$(TB);
//Store into QVD files.
STORE $(TB) INTO $(rawDataPath)$(TB)-$(database)-PRI.qvd
(qvd);
//Drop tables
DROP TABLE $(TB);
NEXT
LET rowNo = rowNo + 1;
LOOP
Hello Aldo,
You already have RowNo() and IterNo() functions which may help you with the loops.
Thanks.
Hi Aldo,
I´m searching for a code, which is similar to your Problem. Do you have a QlikView-Document, which you can send me? It is much easy to understand your code...Thanks
[View:http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.02.89.41/Loop-over-each-value-in-a-field-of-a-table.qvw]
Hi there,
Attached a qvw with the example you need. I took the example from my model which is running ok.
I am not attaching all the Excel files you need to run the qvw, but you can easily understand the script.
I hope it helps you,
Good Luck,
Aldo.