14
Views
6
Comments
Large Factory Management
Question

Hi,

I am managing a large factory. Occasionally, a citizen developer will create an app and never add a module to it. I am wondering what part of the system tables those "shells" might live? I want to create an app that lists them for me so i can delete them. Clicking through the whole factory 1 app at a time may be an option but like i said. . . there are alot of apps. 

Rank: #156

Hi Brett,


Have you tried using OutGource component? It will allow you to see which changes have been made by each developer very quickly.


Additionally, you can use LifeTime User Management and create Teams to only allow people belonging to a team to publish one of its applications (step by step documentation here).


Hope it helps.


Cheers,

João

Rank: #157

Hello Brett,

Hope you are doing well!

All of the applications in your environment should be present in OSSYS_APPLICATION system table.

You can see the relation between applications and modules in OSSYS_APP_DEFINITION_MODULE system table.

For example, if you want to find the applications without modules in it, you can just run this query:

select a.ID, a.NAME
from ossys_application a
where a.IS_ACTIVE = 1 and a.ID NOT IN (
    select am.APPLICATION_ID
    from ossys_app_definition_module am )


Hope that this helps you!


Kind regards,

Rui Barradas

Rank: #156

Hi Brett,


If you are simply looking for applications with no extensions nor eSpaces, you just have to run the following query:

SELECT
	a.NAME [Application Name]
FROM
	{Application} a
WHERE
	a.IS_ACTIVE = 1
    	AND NOT EXISTS
        (
        SELECT
          	1
        FROM
          	OSSYS_ESPACE e
            INNER JOIN
            OSSYS_MODULE m
            ON e.ID = m.ESPACE_ID
          	INNER JOIN
            OSSYS_App_Definition_Module adm
            ON adm.MODULE_ID = m.ID
         WHERE
          	e.IS_ACTIVE = 1
          		AND a.ID = adm.APPLICATION_ID
         )
         AND NOT EXISTS
         (
         SELECT
          	1
        FROM
          	OSSYS_EXTENSION e
            INNER JOIN
            OSSYS_MODULE m
            ON e.ID = m.EXTENSION_ID
          	INNER JOIN
            OSSYS_App_Definition_Module adm
            ON adm.MODULE_ID = m.ID
         WHERE
          	e.IS_ACTIVE = 1
          		AND a.ID = adm.APPLICATION_ID
         )


You can run it using SQL Sandbox. If you want to make a screen showing this information you can use the same query but in OutSystems syntax:

SELECT
    {Application}.[Name]
FROM
    {Application}
WHERE
    {Application}.[Is_Active] = 1
        AND NOT EXISTS
        (
        SELECT
              1
        FROM
              {Espace}
            INNER JOIN
            {Module}
            ON {Espace}.[Id] = {Module}.[Espace_Id]
              INNER JOIN
            {App_Definition_Module}
            ON {App_Definition_Module}.[Module_Id] = {Module}.[Id]
         WHERE
              {Espace}.[Is_Active] = 1
                  AND {Application}.[Id] = {App_Definition_Module}.[Application_Id]
         )
         AND NOT EXISTS
         (
         SELECT
              1
        FROM
              {Extension}
            INNER JOIN
            {Module}
            ON {Extension}.[Id] = {Module}.[Extension_Id]
              INNER JOIN
            {App_Definition_Module}
            ON {App_Definition_Module}.[Module_Id] = {Module}.[Id]
         WHERE
              {Extension}.[Is_Active] = 1
                  AND {Application}.[Id] = {App_Definition_Module}.[Application_Id]
         )


Hope it helps.


Cheers,

João

Staff
Rank: #37

Hello Brett,

Hope you are doing well!

Have you considered to use lifetime API? It has a set of useful endpoints that will allow you to solve your use case: https://success.outsystems.com/Documentation/11/Reference/OutSystems_APIs/LifeTime_API_v2


There are some components in OutSystems Forge that use it and that you can adjust to for your needs.


Cheers, Ricardo

Rank: #222

Breet,

You will find the apps and its espaces or extensions in the follow Diagram:


Entity Application <- App_Definition_Module  <- Module

Then, module will have a FK for Espace or Extension, depending on what kind of item it is.

Some query that can also help you to generate statistics and is very simple is the follow:

It will bring how many Active Espaces and how many Active Extensions your app has.
This way you can generate some reports and use it in some control Dashboard or table in your screen.

It will return both 0 and 0 if the app is empty 

This is the query:

SELECT {Application}.[Name], Count({Espace}.[Id]), Count({Extension}.[Id])
FROM {Application}
LEFT JOIN {App_Definition_Module} ON {App_Definition_Module}.[Application_Id] = {Application}.[Id]
LEFT JOIN {Module} ON {App_Definition_Module}.[Module_Id] = {Module}.[Id]
LEFT JOIN {Espace} ON {Module}.[Espace_Id] = {Espace}.[Id]
LEFT JOIN {Extension} ON {Module}.[Extension_Id] = {Extension}.[Id]
WHERE
{Application}.[Is_Active] = 1 and ({Espace}.[Id] IS NULL or {Espace}.[Is_Active] = 1)  and ({Extension}.[Id] IS NULL or {Extension}.[Is_Active] = 1) 
Group by {Application}.[Name]


Hope it helps,

Cheers and Regards,

RR :)