Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
QVnewbie
Contributor II
Contributor II

Logic test and rename a mapped field

Hi everyone,

First post here, this place has helped me a lot by searching and reading only in the past few weeks.

I think I got a question here that is hard to search for.

 

Question: Can I run a logic test on a mapped field name within the same script.

 

/*Example section in a standard Load & From script:

Load

...

applyMap(LookUpName, Customer_ID, ' ') as [New Name]

If([New Name] = ' ', 'Exclude', 'Include') as [Name Filter]

...

From...

*/

In my results, [New Name] worked well as it returned the proper mapped name.

But, [Name Filter] just returned blank for all results even [New Name] rows that are not blank.

Can I call a mapped field name this way within the same script?

 

Appreciate this big time, been scratching my head for two hours on this...

Labels (3)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

You can't refer a field in the load statement which is created/named in the same load statement. You can rather try like:

applyMap(LookUpName, Customer_ID, ' ') as [New Name]

If(applyMap(LookUpNameCustomer_ID, ' ')  = ' ', 'Exclude', 'Include') as [Name Filter]

 

View solution in original post

4 Replies
tresesco
MVP
MVP

You can't refer a field in the load statement which is created/named in the same load statement. You can rather try like:

applyMap(LookUpName, Customer_ID, ' ') as [New Name]

If(applyMap(LookUpNameCustomer_ID, ' ')  = ' ', 'Exclude', 'Include') as [Name Filter]

 

Vegar
MVP
MVP

No you cant, no renames inside a LOAD are available inside for other calculations inside the load. You can however do a preceding load like this.

Table:
LOAD
*,
If([New Name] = ' ', 'Exclude', 'Include') as [Name Filter]
;
Load
...
applyMap(LookUpName, Customer_ID, ' ') as [New Name]
...
From...
QVnewbie
Contributor II
Contributor II
Author

That sounds like a reasonable approach, how come I didn’t think of that,
will try it out tonight and advise.

Thanks for that!
QVnewbie
Contributor II
Contributor II
Author

Just tried out in QKV, worked really well, learnt something new today.

Thank you champs.

Gavin.