cloud_appstore
The cloud_appstore package tells an application of the app store of Invantive Cloud about its installation: the application, the installation, the user, the organisation of the user and the data containers the organisation chose for it. It is the only way such an application learns these values. Invantive Cloud sets them when it opens the data context of the installation, before any startup SQL runs, and they do not change while that context lives. The package has no procedure and no function that sets a value. Built for release 28.0; not yet released.
The package is available in every product, but its functions return rows only in the data context of an installed application of the app store. Elsewhere, such as in the SQL editor of Invantive Cloud or when the publisher runs the application from its development pages, every function returns no rows. Module code can use this to tell the two apart.
Each function is a table function without parameters, used in a select through table(...). The functions get_application, get_installation, get_user and get_organisation return one row in an installation; get_bindings returns one row per chosen data container. The topic Data Shared with Applications explains what these values are for and what an application never receives.
get_application: The application.
One row with the application and the release the installation runs.
The columns are:
UUID(guid): unique identifier of the application.CODE(string): code of the application in the store, as used in its launch address.RELEASE_CODE(string): code of the release the installation runs. Before the publisher made a release, the value of the field for the current release of the application, which can be empty.CLOUD_URL(string): address of the Invantive Cloud the user opened the application from, ending in a slash, such ashttps://cloud.invantive.com/; a page of the application links back to it, for instance toCLOUD_URL || 'app/apps'for the app store.
get_installation: The installation.
One row with the installation of the application by the organisation of the user.
The columns are:
UUID(guid): unique identifier of the installation. It is the key under which an application stores the rows of the installation in its app database.
get_user: The user.
One row with the user who opened the application.
The columns are:
UUID(guid): unique identifier of the user. An application that tells users apart uses this value, since all users of an organisation share the same data containers and so the same platform user, such as the same Exact Online user.FULL_NAME(string): full name of the user; empty when not known.EMAIL_ADDRESS(string): e-mail address of the user.LANGUAGE_CODE(string): ISO 639-1 language of the user, such asnl.DELEGATED_FLAG(boolean):truewhen the user acts for the organisation through a delegation and is therefore not one of its own users, such as a consultant. A publisher that bills per user can leave such a user out.
get_organisation: The user organisation.
One row with the organisation that installed the application, with the details a publisher needs to bill it. Each detail other than UUID and NAME is empty when unknown, and also when it holds the placeholder - of an organisation made at first use.
The columns are:
UUID(guid): unique identifier of the organisation.NAME(string): name of the organisation.COC_NUMBER(string): Chamber of Commerce number.VAT_NUMBER(string): VAT number.IBAN_NUMBER(string): IBAN.ADDRESS_LINE_1(string): first address line.ADDRESS_LINE_2(string): second address line.ADDRESS_LINE_3(string): third address line.POSTAL_CODE(string): postal code.CITY(string): city.COUNTRY(string): ISO code of the country.
get_bindings: The bound data containers.
One row per data container of the organisation that is chosen for a requirement of the release the installation runs. Every choice is for the whole organisation.
The columns are:
ALIAS(string): alias of the requirement, under which the data container is in the data context, such aseol.PROVIDER_CODE(string): connector code of the data container, such asExactOnlineAll.DATA_CONTAINER_ID(string): data container ID as the connector reported it; for Exact Online the division code.DATABASE_UUID(guid): unique identifier of the database holding the data container.DATABASE_NAME(string): name of the database holding the data container.
Examples
A module "on install" that records the installation and the user in a table of the app database under the alias svc:
insert into installation_users@svc
( installation_uuid
, user_uuid
, email_address
)
select ins.uuid
, usr.uuid
, usr.email_address
from table(cloud_appstore.get_installation()) ins
cross
join table(cloud_appstore.get_user()) usr
Reading which Exact Online division the organisation chose for the requirement eol:
select bdg.data_container_id
from table(cloud_appstore.get_bindings()) bdg
where bdg.alias = 'eol'