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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Karthik_Qlik
Contributor II
Contributor II

Section Access Coding

Hello Team,

I'm new to Qlik Sense and I'm trying Section Access coding. I was using a set of coding provided by one of the team member. I would like to understand, how the code is working

Can anyone guide me to understand this?

Hierarchies:
NoConcatenate
Load
NTNAME,
ATTRIBUTE,
DATAFIELD,
If(WildMatch(DATAFIELD, '*Global*')>0,Trim(Mid(DATAFIELD,1,Len(DATAFIELD)))) as GLOBAL,
If(WildMatch(DATAFIELD, '*GEO L1*')>0,Trim(Mid(DATAFIELD,9,Len(DATAFIELD)))) as GEO,
If(WildMatch(DATAFIELD, '*GEO L2*')>0,Trim(Mid(DATAFIELD,9,Len(DATAFIELD)))) as COUNTRY

Resident UAM;

DROP Table UAM;

Temp1:
NoConcatenate
LOAD
Upper(NTNAME) as USERID,
'' as GLOBAL,
'' as GEO,
'' as COUNTRY
Resident [Hierarchies]
Where
Len(GLOBAL) <> 0;

Temp2:
NoConcatenate
LOAD
Upper(NTNAME) as USERID,
Upper(Trim(GEO)) as GEO
Resident [Hierarchies]
Where
Len(GEO) <> 0;

Inner Join
Load
Upper(Trim(GLOBAL)) as GLOBAL,
Upper(Trim(GEO)) as GEO,
Upper(Trim(COUNTRY)) as COUNTRY
Resident GEO_Hierarchy;

Temp3:
NoConcatenate
LOAD
Upper(NTNAME) as USERID,
Upper(Trim(COUNTRY)) as COUNTRY
Resident [Hierarchies]
Where
Len(COUNTRY) <> 0;

Inner Join
Load
Upper(Trim(GLOBAL)) as GLOBAL,
Upper(Trim(GEO)) as GEO,
Upper(Trim(COUNTRY)) as COUNTRY
Resident GEO_Hierarchy;

Temp:
NoConcatenate
Load *
Resident Temp1;
Concatenate
Load *
Resident Temp2;

Concatenate
Load *
Resident Temp3;

Tempt:
NoConcatenate
Load *
resident Temp;
left Join

Regards,

Karthikeyan A

2 Replies
Dalton_Ruer
Support
Support

1. Not trying to be harsh, as you will see below I have lots of suggestions, but I do want to point out that simply throwing out a blob of code and saying "explain this to me" isn't the kind of thing that anyone appreciates. At least put forth some type of effort to indicate what you are trying to do, what you have done to debug the code, what error messages you are getting, what you have done to try to correct the problems etc. 

2. Ask your teammate that shared their code to start commenting their code so that it is maintainable. Whether it is Qlik Script or any language Commenting code is essential. You can actually make the comments fun by utilizing emojis as call outs. When you solve a complex problem celebrate it by telling the world what you have achieved ... in the comments:

Comments2.png

3. Take each word you don't understand and simply do a Google search. Not trying to sound contrite, but the best way to learn is to dig in. For example the first thing in the code is NoConcatenate. If you search for that word and Qlik Sense you will immediately get a link to the Qlik Help Document for it so that you can read more, and in many cases, like this one, you will find other Qlik Community posts that contain narrative from others about the topic. 

UseGoogle.png

4. At any point in qlik script code you can add an Exit Script statement that will allow you to stop the load processing so that you can see what you have in your data model up to that point. If you place it in a point where you shouldn't you will get an error message. If you place it, per my example, right after your first table called Hierarchies is loaded you can then look at the data model so that YOU can see what the code is doing. 

Hierarchies:
NoConcatenate
Load
NTNAME,
ATTRIBUTE,
DATAFIELD,
If(WildMatch(DATAFIELD, '*Global*')>0,Trim(Mid(DATAFIELD,1,Len(DATAFIELD)))) as GLOBAL,
If(WildMatch(DATAFIELD, '*GEO L1*')>0,Trim(Mid(DATAFIELD,9,Len(DATAFIELD)))) as GEO,
If(WildMatch(DATAFIELD, '*GEO L2*')>0,Trim(Mid(DATAFIELD,9,Len(DATAFIELD)))) as COUNTRY

Resident UAM;

Exit Script;

5. You can refer to this community post that I wrote called Making Sense of Section Access in Qlik Sense. https://community.qlik.com/t5/Documents/Making-Sense-of-Section-Access-in-Qlik-Sense/ta-p/1493716

6. You have posted in Qlik Sense forum but looking at the script I imagine it was written for QlikView. Things like that are important to share for the community so that others can immediately offer help like ... "QlikView used NTNAME but Qlik Sense does not. It looks for USERID field name instead. See this post to see the other differences. https://community.qlik.com/t5/App-Development/Differences-between-Section-Access-in-QlikView-and-Qli...

 

Karthik_Qlik
Contributor II
Contributor II
Author

Hello Dalton

Thank you so much for your quick response on my request 

As you mentioned I've tried searching word by word in google, but I can't relate the examples with my current requirements.

 Will invest more time to understand the script and reach out to you if I want more details

Regards,

K