<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Taming QSR - Informative Queries - Part 1 - Users &amp;amp; Groups in Member Articles</title>
    <link>https://community.qlik.com/t5/Member-Articles/Taming-QSR-Informative-Queries-Part-1-Users-amp-Groups/ta-p/1942133</link>
    <description>&lt;P&gt;Dear Community,&lt;BR /&gt;&lt;BR /&gt;This is the first article from a series in which we will try to demystify QSR database, in order to export useful administrative information.&lt;BR /&gt;&lt;BR /&gt;&lt;U&gt;&lt;STRONG&gt;Notes&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Please do &lt;STRONG&gt;NOT&lt;/STRONG&gt; modify in any case your &lt;STRONG&gt;QSR&lt;/STRONG&gt; Repository.&amp;nbsp;This will void any Support Agreement.&lt;/LI&gt;
&lt;LI&gt;Please execute / schedule your queries in &lt;STRONG&gt;non-busy hours&lt;/STRONG&gt; for your Qlik Sense deployment.&lt;/LI&gt;
&lt;LI&gt;All queries were tested in &lt;STRONG&gt;PostgreSQL v9.6 &lt;/STRONG&gt;and QSR supporting &lt;STRONG&gt;Qlik Sense September 2020&lt;/STRONG&gt;.&lt;/LI&gt;
&lt;LI&gt;You can use &lt;STRONG&gt;pgAdmin&lt;/STRONG&gt; or any other client of your choice (e.g. DBeaver) to execute the queries.&lt;/LI&gt;
&lt;LI&gt;Values contained in &lt;STRONG&gt;&amp;lt;VALUE&amp;gt;&lt;/STRONG&gt;&amp;nbsp;format need to be adjusted according to the settings of your Qlik Sense deployment.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Query 1 -&amp;nbsp;Active Users in groups defined in User Directory Connector&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;STRONG&gt;Tables Used&lt;/STRONG&gt;:&amp;nbsp;public."Users",&amp;nbsp;public."UserAttributes"&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Code&lt;/STRONG&gt;:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;select 
	ua."AttributeValue" as "Group Name"
	,u."Name" as "User Name"
	,u."UserDirectory" as "User Directory"
	,u."UserId" as "User ID"
	,u."RolesString" as "Admin roles"
	,u."CreatedDate"::DATE as "User Creation Date"
from 
	public."Users" u
join
	public."UserAttributes" as ua on ua."User_ID" = u."ID"
where 
	u."UserDirectory" = '&amp;lt;USER_DIRECTORY&amp;gt;'
	and u."Inactive" = False
	and u."RemovedExternally" = False
	and u."Blacklisted" = False
	and ua."AttributeType"='Group'
	and ua."AttributeValue" in ('&amp;lt;QLIK_GROUP_1&amp;gt;','&amp;lt;QLIK_GROUP_2&amp;gt;')
order by 
	ua."AttributeValue"
	,u."Name"&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Explanation&lt;/STRONG&gt;: Tables &lt;STRONG&gt;Users&lt;/STRONG&gt; and &lt;STRONG&gt;UserAttributes&lt;/STRONG&gt;&amp;nbsp;in &lt;STRONG&gt;public&lt;/STRONG&gt; schema contain the desired information. Those tables can be joined on User ID. Finally, you will need to define the &lt;STRONG&gt;UserDirectory&lt;/STRONG&gt; value&amp;nbsp; as well as the &lt;STRONG&gt;AD groups&lt;/STRONG&gt; defined in your User Directory Connector.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Query 2 - Number of Active Users per Qlik Group&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Tables Used&lt;/STRONG&gt;:&amp;nbsp;public."Users",&amp;nbsp;public."UserAttributes"&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Code&lt;/STRONG&gt;:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;select 
	ua."AttributeValue" as "Group Name"
	,count(1) as "Number of Active Users"
from 
	public."Users" u
join
	public."UserAttributes" ua on ua."User_ID" = u."ID"
where 
	u."UserDirectory" = '&amp;lt;USER_DIRECTORY&amp;gt;'
	and u."Inactive" = False
	and u."RemovedExternally" = False
	and u."Blacklisted" = False
	and ua."AttributeType"='Group'
	and ua."AttributeValue" in ('&amp;lt;QLIK_GROUP_1&amp;gt;','&amp;lt;QLIK_GROUP_2&amp;gt;')
group by 
	ua."AttributeValue"
order by
	ua."AttributeValue"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Explanation&lt;/STRONG&gt;: Same as Query 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's the end of the first part for the &lt;STRONG&gt;Taming QSR &lt;/STRONG&gt;article series. Stay tuned for more QSR SQL Wizardry!&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;P.S.&lt;/STRONG&gt;: If you run your queries via&amp;nbsp; &lt;STRONG&gt;pgAdmin&lt;/STRONG&gt;, select your code and 1.) &lt;STRONG&gt;F5&lt;/STRONG&gt; will execute it, 2.) &lt;STRONG&gt;F8&lt;/STRONG&gt; will export the results in csv format.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Jun 2022 11:34:31 GMT</pubDate>
    <dc:creator>ifytra</dc:creator>
    <dc:date>2022-06-10T11:34:31Z</dc:date>
    <item>
      <title>Taming QSR - Informative Queries - Part 1 - Users &amp; Groups</title>
      <link>https://community.qlik.com/t5/Member-Articles/Taming-QSR-Informative-Queries-Part-1-Users-amp-Groups/ta-p/1942133</link>
      <description>&lt;P&gt;Have you ever wished for Qlik Sense QMC exporting its lists (e.g. Users, Reload Tasks) in csv format? This is an article series in which QSR database secrets are&amp;nbsp;demystified and useful queries are provided for further usage.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 11:34:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Taming-QSR-Informative-Queries-Part-1-Users-amp-Groups/ta-p/1942133</guid>
      <dc:creator>ifytra</dc:creator>
      <dc:date>2022-06-10T11:34:31Z</dc:date>
    </item>
  </channel>
</rss>

