Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
vStefano
Contributor II
Contributor II

Section Access - Data Reduction - Substring field

Good morning All,

I need to perform data reduction in a database in order to limit the access of the users just to their company.

Unfortunatly I do not have the company field in the database. However the company corresponds to the first two digits of the customer code. The field is named %CustomerKey

I have tried to set up something like below but it is not working. My idea was to limit, for example, the user Stefano just to see the company 30, hence all the customers beginning with 30.

Can someone help me?

section Access;

Load * Inline [
USERID, ACCESS, KEY
domain\Gino,ADMIN,
domain\Stefano,User,5
domain\Giovanni, User,2
ADMIN,INTERNAL\SA_SCHEDULER,*,
];

Section Application;

DataReduction:
Load * Inline [
KEY, %CustomerKey
2,'20*'
3,'21*'
4,'29*'
5,'30*'

];

 

 

Labels (1)
3 Replies
marcus_sommer

I think it's not possible - why not just creating this matching-field within the script with something like:

left(company, 2)

and using it within the data-reduction?

- Marcus

npatel1
Contributor II
Contributor II

Hi Stefano, Did you find a fix? I am looking for something similar.

TauseefKhan
Creator III
Creator III

Hi @npatel1 @vStefano,

Check With this:

// Section Access Table
section Access;

LOAD * INLINE [
USERID, ACCESS, COMPANYCODE
domain\Gino, ADMIN,
domain\Stefano, USER, 30
domain\Giovanni, USER, 20
ADMIN, INTERNAL\SA_SCHEDULER, *
];

Section Application;

// Data Reduction Table
DataReduction:
LOAD
COMPANYCODE,
LEFT(%CustomerKey, 2) as COMPANYCODECUSTOMER
INLINE [
COMPANYCODE, %CustomerKey
20,'2000'
20,'2001'
21,'2100'
29,'2900'
30,'3000'
30,'3001'
];

// Main Data Load
MainData:
LOAD
*,
LEFT(%CustomerKey, 2) as COMPANYCODECUSTOMER
FROM YourDataSource;

// Ensure data reduction is correctly linked
CONCATENATE (MainData)
LOAD
COMPANYCODECUSTOMER as %CustomerKey
RESIDENT DataReduction;

*** Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.***