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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Preventing load based on field values?

I would like to add a measure of error-prevention to our application to prevent improper data from being loaded, and I was wondering if it was possible to prevent data from loading (or conditionally load) based on the values contained within.  I.E let's say I have the following data which I would like to load from Data.xls...

Security CheckEmployeeSalary

ACCOUNTING

Bob Smith70000
ACCOUNTINGAshkat Ayer75000
ACCOUNTINGCecilia Moralez120000
MANAGEMENTDave Brown15000
RESEARCHTan Xi65000
ACCOUNTINGLarry Marks35000

But, for whatever reason, I want to make sure that ONLY lines with "ACCOUNTING" in "Security Check" are loaded, or - even better - that the file will not load UNLESS "Security Check" is exclusively filled with "Accounting."  Is this possible?

4 Replies
Not applicable
Author

You can add a WHERE clause to your load statement. Such as:

LOAD *

FROM

[<your file>]

Where [Security Check] = 'ACCOUNTING';

maxgro
MVP
MVP

you can check the records are always ACCOUNTING in this way

a:

LOAD [Security Check], Employee, Salary

FROM [http://community.qlik.com/thread/137186] (html, codepage is 1252, embedded labels, table is @1)

;

b:

NoConcatenate load * Resident a where [Security Check] = 'ACCOUNTING';

if NoOfRows('a') <> NoOfRows('b') then

  trace there are records not ACCOUNTING;

ENDIF;

drop table a;

antoniotiman
Master III
Master III

If You don't want to load Table UNLESS ....

Load

count(*) as Count1

from Table

where [Security Check] = 'ACCOUNTING';

Let vCount1 = Peek('Count1');

Load

count(*) as Count2

from Table;

Let vCount2 = Peek('Count2');

If vCount1=vCount2 then

Load * from Table;

ENDIF;

Not applicable
Author

Thanks all - ended up solving this in a different way on the back end.