Skip to main content

Suggest an Idea

Vote for your favorite Qlik product ideas and add your own suggestions.

Add space information to app information area

psublue98
Creator
Creator

Add space information to app information area

Similar to the post on expanding the app information section to include app owner information, so too could this area use further expansion to include space information (ex. Personal or Managed Space - [space name] or Shared Space - [space name]).

Working on same named apps across the variety of spaces can be confusing without further context. Enriching the app information area could greatly aid development by adding a key breadcrumb and indicator for which app and space you are working or viewing. Thanks!

Please add space infoPlease add space info

6 Comments
Ian_Crosland
Employee
Employee
 
Status changed to: Open - Collecting Feedback
psublue98
Creator
Creator

Thank you for considering! Couple times this past week where this would have been helpful.

E_Røse
Creator II
Creator II

Not a very good solution, but with some adjustment in the code from one of the analyzer apps, it is possible to retrieve the space of the app using the REST api connector.The following works, but this was  a very, very, very quick fix, so this can for sure be simplified a lot, and probably a good idea, to use a variable for the space name and drop the tables. The code below is a modification of 2 of the sections of the script in the Entitlement analyzer app. Ideally it should be available in the description area of the app, and preferably also as a function one could call from within the app.

 

 

 

// config

/* 
1. Fully qualified domain name for your tenant. 
		Example: 'company.us.qlikcloud.com'
*/
SET vu_tenant_fqdn = '<tenant>.<region>.qlikcloud.com';

/*
2. The name of the REST connection that will be used. You must first create a valid REST connection to any endpoint to Qlik Sense tenant.
		Example: '<Space>:<Connection Name>'
        			Note: ':<Connection Name>' is the relative path which will check for a connection in the current space.
		Example Connection: 
					URL: 			https://<tenant-name>.<region>.qlikcloud.com/api/v1/items
					Header: 		"Authorization"
					Header Value: 	"Bearer <token>"
		For reference on how to connect: 
					https://qlik.dev/tutorials/generate-your-first-api-key
*/
SET vu_rest_connection = '<Name of space with connection>:REST_connection';





//---------------------------------------------------------
// code



Sub get_spaces

	SET vParams = 'limit=100';  
    
    [Spaces_pre]:
    Load * Inline [SpaceID];

  	Do
  
        LIB Connect To '$(vu_rest_connection)';

        RestConnectorMasterTable:
        SQL SELECT 
            "__KEY_root",
            (SELECT 
                "id",
                "type",
                "ownerId",
                "tenantId",
                "name",
                "description",
                "createdAt",
                "createdBy",
                "updatedAt",
                "__KEY_data",
                "__FK_data",
                (SELECT 
                    "__KEY_meta",
                    "__FK_meta"
                FROM "meta" PK "__KEY_meta" FK "__FK_meta"),
                (SELECT 
                    "__KEY_links",
                    "__FK_links"
                FROM "links" PK "__KEY_links" FK "__FK_links")
            FROM "data" PK "__KEY_data" FK "__FK_data"),
            (SELECT 
                "__KEY_links_u0",
                "__FK_links_u0",
                (SELECT 
                    "href" AS "href_u2",
                    "__FK_next"
                FROM "next" FK "__FK_next")
            FROM "links" PK "__KEY_links_u0" FK "__FK_links_u0")
        FROM JSON (wrap on) "root" PK "__KEY_root"
        WITH CONNECTION (  
          URL "https://$(vu_tenant_fqdn)/api/v1/spaces?$(vParams)"
        );

        Concatenate (Spaces_pre)
        Load	
            [id] AS SpaceID,
            Capitalize([type]) AS SpaceType,
            [name] AS SpaceName
        Resident RestConnectorMasterTable
        Where not IsNull([__FK_data]);

        NextURL:
        Load	
        	[href_u2] AS NextURL
        Resident RestConnectorMasterTable
        Where not IsNull([__FK_next]);

        Drop Table RestConnectorMasterTable;

        LET vParams = SubField(Peek('NextURL',0,'NextURL'),'?',-1);
        LET vNextURLRows = NoOfRows('NextURL');

        Drop Table NextURL;
    
	Loop while $(vNextURLRows)>0;
  
    Concatenate(Spaces_pre)
    Load
        'Personal' AS SpaceID,
        'Personal' AS SpaceName,
        'Personal' AS SpaceType
    AutoGenerate(1);

    AllSpacesMap:
    Mapping Load Distinct
        SpaceID,
        1
    Resident Spaces_pre;

End Sub



Sub get_apps

	SET vParams = 'limit=100';
  
  	Do
  
        LIB Connect to '$(vu_rest_connection)';

        RestConnectorMasterTable:
        SQL SELECT 
            "__KEY_root",
            (SELECT 
                "name" AS "name_u0",
                "resourceCustomAttributes",
                "resourceUpdatedAt",
                "resourceType",
                "resourceId",
                "resourceCreatedAt",
                "id" AS "id_u0",
                "createdAt",
                "updatedAt",
                "creatorId",
                "updaterId",
                "tenantId",
                "isFavorited" AS "isFavorited_u0",
                "ownerId" AS "ownerId_u0",
                "description" AS "description_u0",
                "__KEY_data",
                "__FK_data",
                (SELECT 
                    "_resourcetype",
                    "createdDate",
                    "description",
                    "dynamicColor",
                    "hasSectionAccess",
                    "id",
                    "lastReloadTime",
                    "modifiedDate",
                    "name",
                    "originAppId",
                    "owner",
                    "ownerId",
                    "publishTime",
                    "published",
                    "spaceId",
                    "thumbnail",
                    "encrypted",
                    "__FK_resourceAttributes"
                FROM "resourceAttributes" FK "__FK_resourceAttributes"),
                (SELECT 
                    "__KEY_links",
                    "__FK_links"
                FROM "links" PK "__KEY_links" FK "__FK_links"),
                (SELECT 
                    "__KEY_meta",
                    "__FK_meta"
                FROM "meta" PK "__KEY_meta" FK "__FK_meta")
            FROM "data" PK "__KEY_data" FK "__FK_data"),
            (SELECT 
                "__KEY_links_u0",
                "__FK_links_u0",
                (SELECT 
                    "href" AS "href_u4",
                    "__FK_next"
                FROM "next" FK "__FK_next")
            FROM "links" PK "__KEY_links_u0" FK "__FK_links_u0")
        FROM JSON (wrap on) "root" PK "__KEY_root"
        WITH CONNECTION (  
        	URL "https://$(vu_tenant_fqdn)/api/v1/items?$(vParams)"
        );


        [Apps]:
        Load	
            [name_u0] AS AppName,
            [resourceId] AS appId
         Resident RestConnectorMasterTable
        Where not IsNull([__FK_data])
        and  [resourceId]=documentname()
        and resourceType='app' or resourceType='qvapp' AND EXISTS(appId,[resourceId])
        ;


        //left keep(Apps)
       AppDetails:
        Load	
            [id] AS appId,
            [owner] AS AppOwnerName,
            If(ApplyMap('AllSpacesMap',spaceId)<>1,'Personal',spaceId) AS SpaceID
        Resident RestConnectorMasterTable
        Where not IsNull([__FK_resourceAttributes]) AND EXISTS(appId,[id])
        and id=documentname();

		noconcatenate
        NextURL:
        Load	
            [href_u4] AS NextURL
        Resident RestConnectorMasterTable
        Where not IsNull([__FK_next]);

        Drop Table RestConnectorMasterTable;

        LET vParams = SubField(Peek('NextURL',0,'NextURL'),'?',-1);
        LET vNextURLRows = NoOfRows('NextURL');

        Drop Table NextURL;

	Loop while $(vNextURLRows)>0;
  
END SUB;

Call get_spaces;
Call get_apps;



Left keep(AppDetails)
Spaces:
Load * resident Spaces_pre;
Drop table Spaces_pre;

 

 

  

Meghann_MacDonald

From now on, please track this idea from the Ideation portal. 

Link to new idea

Meghann

NOTE: Upon clicking this link 2 tabs may open - please feel free to close the one with a login page. If you only see 1 tab with the login page, please try clicking this link first: Authenticate me! then try the link above again. Ensure pop-up blocker is off.

Ideation
Explorer II
Explorer II
 
Status changed to: Closed - Archived