My Products
Help

Model translations

by Marius Bancila

The GraphQL schema uses "identifiers" for tables, columns, processings, reports, parameters, etc. These are all English names. We have been asked to make it possible to fetch their translated versions to the BNXT supported languages.

 

I'd like to present here our idea of how the schema should include to make this possible. I'd like to hear your opinions before we decide on a final version.

 

Model translations will be available under a field called useModel (similar to useCompany and useCustomer). This will allow you to query translations for:

  • tables
  • columns
  • processings
  • reports
  • folders

More things could be added in the future, based on your needs.

 

Reading table names in Norwegian can be done as follows:

 

query read_model_translations
{  
  useModel
  {      
    tables(lang : NORWEGIAN)
    {
      tableNo
      name
      identifier
    }    
  }
}

 

If you want the name of a particular table, you can use an additional argument, tableNo:

 

query read_model_translations
{  
  useModel
  {      
    tables(lang : NORWEGIAN, tableNo : 42)
    {
      tableNo
      name
      identifier
    }    
  }
}

 

The supported languages are the ones available in the UI too. The lang argument is actually optional, and if not provided, English is the default language.

 

Similarly, you can query for columns:

  • all the columns
  • all the columns in a table
  • a single column

All the columns:

 

query read_model_translations
{  
  useModel
  {      
    columns(lang : NORWEGIAN)
    {
      columnNo
      tableNo
      name
      identifier
    }    
  }
}

 

All the columns in a table:

 

query read_model_translations
{  
  useModel
  {      
    columns(lang : NORWEGIAN, tableNo: 42)
    {
      columnNo
      tableNo
      name
      identifier
    }    
  }
}

 

A single column:

 

query read_model_translations
{  
  useModel
  {      
    columns(lang : NORWEGIAN, columnNo: 816)
    {
      columnNo
      tableNo
      name
      identifier
    }    
  }
}

 

More examples with processings, reports, and folders:

 

query read_model_translations
{  
  useModel
  {      
    processings(lang : NORWEGIAN)
    {
      processingNo
      name
      identifier
    }
    
    reports(lang : NORWEGIAN)
    {
      reportNo
      name
      identifier
    }
    
    folders(lang : NORWEGIAN)
    {
      folderNo
      name
      identifier
    }
  }
}

 

Please let us know if this suites your needs.

8 REPLIES 8

by David Tandberg-Johansen

Hi,

Is it possible to be able for returning the SQL name of the tables and columns?

You don't have direct access to the DB like for on-premise. So what would you use that for?

omelhus
PARTNER

by omelhus

I’m using this for local mirror compatible with existing queries.

omelhus
PARTNER

I have this as an internal api if it’s something you need.

omelhus
PARTNER

by omelhus

Will this be able to return user defined translations as well? I think "definitions" or just "model" is a better name than useModel, as I don't see how "use" fits in this context.

 

query {
  useCustomer(no: X) {
    definitions(language: USER_DEFINED) {
      tables(tableNo: 42) {
        ...TableDefinition
      }
    }
  }
}

by Marius Bancila

User-defined translations are available in the Translations table that you can already query.

omelhus
PARTNER

by omelhus

Ok. So this is more like access to Visma.BusinessModel.xml through the api?

by Marius Bancila

No, that's the model. It does not contain the translations. Those are located in other files.