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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

Error in script

Hey, My script is:

=if(GetSelectedCount(_CalendatType) = 0 , $(vSalesbookUsage) ,

if(_CalendarType = 'Fiscal' , GetFieldSelections([TradeFiscalYear]) & '-' & GetFieldSelections([TradeFiscalQuarter]) ,

if(vTradeCalendarType = '1D' , date(max(){1}TradeDateMaster), 'MM/DD/YYY'),

if(vTradeCalendarType = 'Custom' , Date($(vTradeStartDate) , 'MM/DD/YYYY') & '-' & Date($(vTradeEndDate) , 'MM/DD/YYYY')))))

where, vSalesbookUsage = SalesBookUsage.

But issue is whenever i clear everything sometimes SalesbookUsage in straight table caption is not shown. Last Selected Date is shown. ALso when i reopen the file, last selected date is shown while it should show SalesBookUsage.

What to do??

Thanks

14 Replies
sunny_talwar

You can use where exist condition while concatenating to make sure you only load column entries which are not already present.

And answer to your first question: How to do it without trigger: I don't know any way (right now). I am going to do some research at my end to see if I can find a way to do it without using triggers.

Best,

Sunny

nikhilgarg
Specialist II
Specialist II
Author

Thanx sunny. But shouldn't we use where not exist like;

1: load salespersonname from table1;

Concatenate

Load salespersonname from table2 where not exist salespersonname ;

Concatenate

Load salespersonname from table3 where not exist salespersonname ;

Is it so?

2: after loading above tables i want to use applymap() to get the

salesregion for all available salesperson. But i am in a fix how to get

that. Can you help.

sunny_talwar

Nikhil you are right. We will be using where not exist. I was just hinting towards the use of where exist condition, but the actual coding in your case would require you to use where not exist.

You need help with the syntax for ApplyMap?

Best,

Sunny

nikhilgarg
Specialist II
Specialist II
Author

Actually i need to know how exactly i can apply the applymap() with above

code. I know the syntax although. I want to have salesregion for every

salesperson. Applymap() is used to get salesregion. Do i need to use

applymap() with evry load statement ?

nikhilgarg
Specialist II
Specialist II
Author

Hey sunny,

I am using:

Table1:

Load SalespersonName,

applymap('Table2' , Desk , 'Unknown') as Desk,

applymap('Table3' , Region , 'Unknown') as Region ;

select salespersonname from table abc;

concatenate

Load SalespersonName ,

applymap('Table2' , Desk , 'Unknown') as Desk,

applymap('Table3' , Region , 'Unknown') as Region

where not exists(salespersonName);

select salespersonname from table def;

Is this correct?

Thanks