Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
shane_spencer
Specialist
Specialist

Text object - count of rows in a table ONLY if table exists

I have a Table that may or may not be loaded in to a desktop App.  The table is called ICA. 

I want to put a text box on a page with a row count.

If the table is present I want to know how many rows there are. Or more to the point if there are more than zero rows.

If the table is not present I don't want to show anything.

I can't simply do a Count(ICA_Number) because if the table is not present at all it will show as Zero (0). This does not differentiate between the table not existing and the table having no data in it.  n.b. ICA_Number is a unique fieldin ICA.

I suppose I could do this using a variable created in the script using FieldNumber and NoOfRows but I rather not use a variable as there's potential it does not get reset correctly and reports falsely. Therefore I would like something more dynamic. I thought I could do NoOfColumns('ICA') but that does not appear to work in text box.

Labels (5)
1 Solution

Accepted Solutions
shane_spencer
Specialist
Specialist
Author

3 Replies
HirisH_V7
Master
Master

LET vRows=null();
Data:
LOAD Customer, [Sales Order ID], ShipDate, Product, Sales, Quantity
FROM [Sales Orders.xls] (biff, embedded labels, table is [Sales Orders$]);

LET vRows=NoOfRows('Data');
HirisH
“Aspire to Inspire before we Expire!”
shane_spencer
Specialist
Specialist
Author

I said I rather not do it in the script using a variable. I would prefer something more dynamic in a text box.
shane_spencer
Specialist
Specialist
Author

I found this:

https://community.qlik.com/t5/QlikView-App-Development/Check-if-table-exist-through-expressions/td-p...
i.e.
SubStringCount(';' & Concat(DISTINCT $Table, ';') & ';', ';ICA;')=1