Model information

Query model information using useModel to retrieve details on tables, columns, relations, domains, processings, reports, and folders.

You can query information from the data model. This is possible using the useModel field in the top-level query. This allows to retrieve information about the following entities:

  • tables
  • columns
  • relations
  • domains and domain members
  • processings
  • reports
  • folders

The information that is available for each entity include:

  • primary key (such as tableNo for tables, columnNo and tableNo for columns, etc.)
  • identifier, which is a language-independent name of the field; this is what the GraphQL schema uses for entity names
  • name, which is a language-specific name for the entity
  • access restrictions and availability

In addition, each type of entity has it’s own specific fields.

The languages supported for translations are:

  • English (this is the default, if no language is specified)
  • Norwegian
  • Swedish
  • Danish

Here is an example for fetching the ID, identifier, name in Norwgian, and the database type it belongs to (which can be either COMPANY or SYSTEM) for all the existing tables:

Query

query get_tables_info
{
  useModel
  {
    tables(lang: NORWEGIAN)
    {
      tableNo
      name
      identifier
      databaseType
    }
  }
}
Result

{
  "data": {
    "useModel": {
      "tables": [
        {
          "tableNo": 1,
          "name": "Arbeidsområde­vindu",
          "identifier": "WorkspaceWindow",
          "databaseType": "SYSTEM"
        },
        {
          "tableNo": 2,
          "name": "Arbeidsområde­element",
          "identifier": "WorkspacePageElement",
          "databaseType": "SYSTEM"
        },
        # ...
        {
          "tableNo": 457,
          "name": "Inngående betalingslinje",
          "identifier": "AutopayVipPaymentLine",
          "databaseType": "COMPANY"
        },
        {
          "tableNo": 458,
          "name": "Inngående betaling ekstratekst",
          "identifier": "AutopayVipTextInfo",
          "databaseType": "COMPANY"
        }
      ]
    }
  }
}

On the other hand, it’s possible to ask for this information for a specific table by specifying the table number:

Query

query get_table_info
{
  useModel
  {
    tables(lang: NORWEGIAN,
           tableNo : 152)
    {
      tableNo
      name
      identifier
      databaseType
    }
  }
}
Result

{
  "data": {
    "useModel": {
      "tables": [
        {
          "tableNo": 152,
          "name": "Aktør",
          "identifier": "Associate",
          "databaseType": "COMPANY"
        }
      ]
    }
  }
}

Similarly, you can query, for instance, for:

  • all the columns in the system
  • all the columns of a specified table
  • a single column specifed by its column number

In the next example, we query information about all the columns from the Associate table:

Query

query get_columns_info
{
  useModel
  {
    columns(lang: NORWEGIAN,
            tableNo : 152)
    {
      columnNo
      tableNo
      name
      identifier
    }
  }
}
Result

{
  "data": {
    "useModel": {
      "columns": [
        {
          "columnNo": 4028,
          "name": "Aktørnr",
          "identifier": "AssociateNo"
        },
        {
          "columnNo": 4029,
          "name": "Navn",
          "identifier": "Name"
        },
        # ...
      ]
    }
  }}  

On the other hand, in the next example, we query information about the associate number column (from the Associate table):

Query

query get_column_info
{
  useModel
  {
    columns(lang: NORWEGIAN,
            columnNo: 4028)
    {
      columnNo
      tableNo
      name
      identifier
    }
  }
}
Result

{
  "data": {
    "useModel": {
      "columns": [
        {
          "columnNo": 4028,
          "tableNo": 152,
          "name": "Aktørnr",
          "identifier": "AssociateNo"
        }
      ]
    }
  }
}

You can additionaly query for domain information for a column, as shown in the following example:

Query

query read_column_info
{
  useModel
  {
    columns(lang: NORWEGIAN,
            columnNo : 3363)
    {
      columnNo
      tableNo
      name
      domain
      {
        domainNo
        name
        length
        columnWidth
       storeFixedDecimals
       displayFixedDecimals
       fixedDecimals
       dataType
        fieldJustification
        fileName
        domainMembers
        {
          name
          identifier
          valueNo
          includeValue
          initiallyOn
        }
      }
    }
  }
}
Result

{
  "data": {
    "useModel": {
      "columns": [
        {
          "columnNo": 3363,
          "tableNo": 52,
          "name": "Ordrenr",
          "domain": {
            "domainNo": 555,
            "name": "Ordrenr",
            "length": 0,
            "columnWidth": 8,
            "storeFixedDecimals": false,
            "displayFixedDecimals": false,
            "fixedDecimals": 0,
            "dataType": "INT_32",
            "fieldJustification": "RIGHT",
            "fileName": false,
            "domainMembers": []
          }
        }
      ]
    }
  }
}

You can also query domains directly, by specifying the domain number:

Query

query read_domain_info
{
  useModel
  {
    domains(lang: NORWEGIAN,
            domainNo : 555)
    {
      domainNo
      name
      length
      columnWidth
      storeFixedDecimals
      displayFixedDecimals
      fixedDecimals
      dataType
      fieldJustification
      fileName
      domainMembers
      {
        name
        identifier
        groupName
        valueNo
        includeValue
        groupIncludeValue
        initiallyOn
      }
    }
  }
}
Result

{
  "data": {
    "useModel": {
      "domains": [
        {
          "domainNo": 555,
          "name": "Ordrenr",
          "length": 0,
          "columnWidth": 8,
          "storeFixedDecimals": false,
          "displayFixedDecimals": false,
          "fixedDecimals": 0,
          "dataType": "INT_32",
          "fieldJustification": "RIGHT",
          "fileName": false,
          "domainMembers": []
        }
      ]
    }
  }
}

Some domains are enumeration types. They define a set of possible values that can be stored in a column. The domainMembers field in the domain information query returns a list of domain members. An example is shown below:

Query

query read_domain_info
{
  useModel
  {
    domains(lang: NORWEGIAN,
            domainNo : 111)
    {
      domainNo
      name
      length
      columnWidth
      storeFixedDecimals
      displayFixedDecimals
      fixedDecimals
      dataType
      fieldJustification
      fileName
      domainMembers
      {
        name
        identifier
        groupName
        valueNo
        includeValue
        groupIncludeValue
        initiallyOn
      }
    }
  }
}
Result

{
  "data": {
    "useModel": {
      "domains": [
        {
          "domainNo": 111,
          "name": "Dok.­type",
          "length": 0,
          "columnWidth": 8,
          "storeFixedDecimals": false,
          "displayFixedDecimals": false,
          "fixedDecimals": 0,
          "dataType": "INT_32",
          "fieldJustification": "RIGHT",
          "fileName": false,
          "domainMembers": [
            {
              "name": "Purrebrev",
              "identifier": "Reminder",
              "groupName": "",
              "valueNo": 1,
              "includeValue": -1,
              "groupIncludeValue": -1,
              "initiallyOn": false
            },
            {
              "name": "Rentenota",
              "identifier": "InterestNote",
              "groupName": "",
              "valueNo": 2,
              "includeValue": -1,
              "groupIncludeValue": -1,
              "initiallyOn": false
            }
          ]
        }
      ]
    }
  }
}

Text transformations

The translated text may contain several application-specific escape characters or sequences. These are:

  • ^ for a hyphen
  • | for a new line (\n)
  • & for an access key accelerator
  • {Ampersand} for an & character

When you retrieve the translated texts, these are automatically replaced with the appropriate character or sequence of characters. However, you can opt to perform your own custom replacement. This is possible with the following two arguments, available for all the fields under useModel:

Argument Description
transform Indicates the transformation type: AUTO (the default option, application defined transformations), NONE (no transformation is performed), and CUSTOM (user-specified transformations are applied).
transformArgs Defines the transformation arguments when the CUSTOM value is specified for the transform argument.

The properties of the transformArgs parameter are as follows:

Property Type Description
modifyOptionalHyphen Boolean Indicates whether hyphen replacement will be performed.
optionalHyphen String Text for replacing the escape character (^) for a hyphen.
modifyManualLineBreak Boolean Indicates whether manual line break replacement will be performed.
manualLineBreak String Text replacing the escape character for manual line break.
modifyAccessKey Boolean Indicates whether access key replacement will be performed.
accessKey String Text for replacing the escape character (&) for an access key.
modifyAmpersandSubstitute Boolean Indicates whether ampersand substitute replacement will be performed.
ampersandSubstitute String Text for replacing the {Ampersand} escape sequence.

Here is an example for fetching raw texts:

Query

query get_table_info
{
  useModel
  {
    tables(lang: NORWEGIAN,
           tableNo : 138,
           transform : NONE)
    {
      tableNo
      name
      identifier
    }
  }
}
Result

{
  "data": {
    "useModel": {
      "tables": [
        {
          "tableNo": 138,
          "name": "Ordre^journal",
          "identifier": "OrderJournal"
        }
      ]
    }
  }
}

On the other hand, the following sample shows how to perform user-defined transformations:

Query

query get_table_info
{
  useModel
  {
    tables(lang: NORWEGIAN,
           tableNo : 138,
           transform : CUSTOM,
        transformArgs : {
              modifyOptionalHyphen : true
              optionalHyphen : "-"
          })
    {
      tableNo
      name
      identifier
    }
  }
}
Result

{
  "data": {
    "useModel": {
      "tables": [
        {
          "tableNo": 138,
          "name": "Ordre-journal",
          "identifier": "OrderJournal"
        }
      ]
    }
  }
}

Access restrictions and availability

Most model entities provide properties that indicate the availability and access restrictions. These properties are:

Property Type Description Applies to
visible Bool Indicates whether the entity is visible in the on-premise application. All
cloudVisible Bool Indicates whether the entity is visible in the BNXT front-end application. All
writable Bool Indicates whether the entity is writable in the on-premise application. Columns, domain members
cloudWritable Bool Indicates whether the entity is writable in the BNXT front-end application. Columns, domain members
insertable Bool Indicates whether the entity is insertable in the on-premise application. Tables
cloudInsertable Bool Indicates whether the entity is insertable in the BNXT front-end application. Tables
updatable Bool Indicates whether the entity is updatable in the on-premise application. Tables
cloudUpdatable Bool Indicates whether the entity is updatable in the BNXT front-end application. Tables
deletable Bool Indicates whether the entity is deletable in the on-premise application. Tables
cloudDeletable Bool Indicates whether the entity is deletable in the BNXT front-end application. Tables
readAccess Access Indicates the read access level for the entity in the on-premise application. All
cloudReadAccess CloudAccess Indicates the read access level for the entity in the BNXT front-end application. All
writeAccess Access Indicates the write access level for the entity in the on-premise application. Columns, domain members
cloudWriteAccess CloudAccess Indicates the write access level for the entity in the BNXT front-end application. Columns, domain members
insertAccess Access Indicates the insert access level for the entity in the on-premise application. Tables
cloudInsertAccess CloudAccess Indicates the insert access level for the entity in the BNXT front-end application. Tables
updateAccess Access Indicates the update access level for the entity in the on-premise application. Tables
cloudUpdateAccess CloudAccess Indicates the update access level for the entity in the BNXT front-end application. Tables
deleteAccess Access Indicates the delete access level for the entity in the on-premise application. Tables
cloudDeleteAccess CloudAccess Indicates the delete access level for the entity in the BNXT front-end application. Tables
deleteAccess Access Indicates the delete access level for the entity in the on-premise application. Tables
cloudDeleteAccess CloudAccess Indicates the delete access level for the entity in the BNXT front-end application. Tables
executionAccess Access Indicates the execution access level for the entity in the on-premise application. Processings, reports
cloudExecutionAccess CloudAccess Indicates the execution access level for the entity in the BNXT front-end application. Processings, reports
availability Availability Indicates whether the entity is available for use (CURRENT), it will be available in the future (FUTURE), or it is available but it is deprecated and will be removed (OBSOLETE). All

The Default value for CloudAccess indicates that the access level is inherited from the on-premise application.

For a column to be available in GraphQL for reading, the following conditions must be met:

  • availability should be CURRENT
  • cloudReadAccess must be different than NONE and DEFAULT
  • if cloudReadAccess is DEFAULT then readAccess must be different than NONE

Similar rules are used for writing, inserting, updating, deleting, and executing access.

Model information properties

Tables

The following properties are available for tables :

Property Type Description
tableNo Long The table number.
name String The translated name of the table.
identifier String A language-independent identifier of the table.
databaseType DatabaseTypeNo One of COMPANY or SYSTEM.
view bool Indicates whether the table is a view.
primaryKeyClustered Bool Indicates whether the primary key is clustered.
orgUnitClass OrgUnitClass The property returns one of the twelve values ORGUNITCLASS01 (1) – ORGUNITCLASS12 (12) if the table is associated with an organisational unit class, else NONE (0). The table will not be visible if the corresponding CompanyInformation.OrgUnit1NameOrgUnit12Name column is empty.
folderNo Long The folder number the table belongs to, or 0 if none.
formView Bool true if new table page elements against this table should initially be displayed in Form view (instead of Grid view).
primaryKeyAssignment PrimaryKeyAssignment Returns one of the following values for how the last primary key column is assigned a value on rows in the table: NORMAL - the ordinary behaviour of the table, INCREMENTAL - the last primary key column will get the next unused value when a value suggestion is requested, or IDENTITY - The last primary key column is created as an IDENTITY column in the database (the last two only for top tables that does not have a sort sequence column).
fromRelationsNo [Long] A collection of relation numbers for the relations from the table, in priority order.
toRelationsNo [Long] A collection of relation numbers for the relations to the table.
processingsNo [Long] A collection of processing numbers for the processings in the table.
reportsNo [Long] A collection of report numbers for the reports in the table.

Relations

The following properties are available for relations:

Property Type Description
relationNo Long The relation number.
name String The translated name of the relation.
identifier String A language-independent identifier of the relation.
fromTableNo Long The table number that this relation refers from.
toTableNo Long The table number that this relation refers to.
fromColumnsNo [Long] A collection of column numbers that define the from columns.
toColumnsNo [Long] A collection of column numbers that define the to columns.
switchOfColumnNo Long The number of a column for this relation to apply to.
switchValue Int The value that a column needs to have for this relation to apply. E.g. the debit (or credit) account type column on a voucher row that determines whether the debit (or credit) account number column refers to (1) a customer, (2) supplier, (3) general ledger account, or (4) capital asset.
noLookup Bool true if the relation is not applicable for lookup, but e.g. only for (left outer) join purposes in i.a. layouts.
necessity Necessity Returns one of the following values for how necessary a corresponding reference is: REQUIRED, OPTIONAL, or PASS.
deleteRule DeleteRule Returns one of the following values to determine behavior when deleting or discarding a parent row: CASCADE will also delete or discard child rows, recursively downwards the hierarchy, or RESTRICT that demands that no references exist, e.g. to reject deletion of accounts with transactions.

Columns

The following properties are available for columns:

Field Type Description
columnNo Long The column number.
tableNo Long The table number that this column belongs to.
name String The translated name of the column.
identifier String A language-independent identifier of the column.
orgUnitClass OrgUnitClass One of the twelve values ORGUNITCLASS01ORGUNITCLASS12 if the column is associated with an organisational unit class, else NONE. The column will not be visible if the corresponding CompanyInformation.OrgUnit1NameOrgUnit12Name column is empty.
suggestValueInInterval Bool true if the column supports suggesting values in intervals.
breakValues Bool true if the column by default should show an aggregated value on group and total rows.
accumulateOnMerge Bool true if the value in the column should be accumulated when rows are merged, e.g. on collection invoices.
recalculation Recalculation one of the following values for whether the value in the column should be recalculated according to the actual value on the current, parent row (order line), when page elements (e.g. stock balance or shipment) are joined via an underlying table (e.g. product): NO, UNIT, or PRICE.
formatting Formatting one of the following values for whether the column should apply formatting defined on the row: NO, ROWFRONT, or UNDERLINE.
viewZero ViewZero one of the following values for whether 0 should be shown if the column is empty: NO, ZEROIFEMPTY, or ZEROIFNOTSUMLINE.
debitCreditType DebitCreditType one of the following values for how the memory column should be calculated: NONE, DEBIT, CREDIT.
currencyHandling CurrencyHandling one of the following values for whether the column is involved in currency calculations: NORMAL, LOGISTICSDOMESTICVALUE, ACCOUNTINGCURRENCYVALUE, ACCOUNTINGDOMESTICVALUE, EUROVALUE, or CURRENCY2VALUE.
lookupProcessingNo Long The number of the processing that declares the lookup dialog for this column, if any.

Domains and domain members

The following properties are available for domains:

Field Type Description
domainNo Long The domain number.
name String The translated name of the domain.
dataType DataType The kind of data that is stored in the column. Can be one of: INT_8, INT_16, INT_32, INT_64, DECIMAL, LIMITED_STRING, UNLIMITED_STRING, BLOB.
lenght Int The maximum number of characters that can be stored, or 0 if the domain type is not LIMITED_STRING.
columnWidth Decimal The default column width, measured in the average number of characters that will fit in the column.
storeFixedDecimals Bool true if the domain type is DECIMAL and a fixed number of decimals should be stored.
displayFixedDecimals Bool true if the domain type is DECIMAL and a fixed number of decimals should be displayed by default.
fixedDecimals Int The actual number of fixed decimals (up to 6) that may be applied by default if the domain type is DECIMAL, else 0.
fieldJustification FieldJustification Returns one of the following values for how the values (and the column heading in grid view) should be aligned by default: CENTER, LEFT, or RIGHT.
fileName Bool true if the domain type is LimitedString and file name lookup is applicable.
domainMembers [Query_UseModel_Domains_DomainMembers] A list of domain member objects.

The following properties are available for domain members:

Field Type Description
valueNo Long Unique domain member indentification number.
identifier String A language-independent identifier of the domain member.
name String The name of the domain member.
includeValue Int An integer value to include in the name, or -1 if not applicable.
groupName String The name of the group the domain member belongs to.
groupIncludeValue Int An integer value to include in the group name, or -1 if not applicable.
initiallyOn Bool true if this flag domain member is intended to be initially ON.

Processings

The following properties are available for processings:

Field Type Description
processingNo Long The processing number.
name String The translated name of the processing.
identifier String A language-independent identifier of the processing.
description String A textual description of the processing.
dialogOnly Bool true if the processing is intended to only show a dialog, typically visualizing one or more columns. Such processings have no parameters, and no processing contributions in the backend, so operations for getting data for a processing dialog, or executing a processing, should not be performed on them.
rowIndependent Bool true if the processing is row-independent.

Reports

The following properties are available for reports:

Field Type Description
processingNo Long The report number.
name String The translated name of the report.
identifier String A language-independent report of the processing.
description String A textual description of the report.

Folders

The following properties are available for folders:

Field Type Description
folderNo Long The folder number.
name String The translated name of the folder.
identifier String A language-independent identifier of the folder.
isRoot Lool true if the folder is a root folder.
parentFolderNo Long The number of the parent folder, or 0 if the folder is a root folder.
childFoldersNo [Long] A collection of folder numbers for the child folders.

Language selection

The language for the translations can be specified in two ways:

  • using the lang argument in the query, with one of the following values: ENGLISH, NORWEGIAN, SWEDISH, DANISH
  • using the langNo argument in the query, with one of the following values: 44 (English), 45 (Danish), 46 (Swedish), 47 (Norwegian)

If both arguments are specified, the lang argument is used (langNo is ignored).

The following two examples are equivalent:

Query

query get_tables_info
{
  useModel
  {
    tables(lang: NORWEGIAN)
    {
      tableNo
      name
      identifier
      databaseType
    }
  }
}
Result

query get_tables_info
{
  useModel
  {
    tables(langNo: 47)
    {
      tableNo
      name
      identifier
      databaseType
    }
  }
}

The langNo argument is useful for specifying the language based directly on settings, such as the user’s language preference (from the User table).

Last modified September 24, 2024