Translated labels in reports

  • 8 January 2019
  • 0 replies
Translated labels in reports
Userlevel 6
Badge +9

When creating multi-language applications, or applications for companies with customers in different countries, you probably want to translate the report labels too. To translate labels in a report you can retrieve the label transition from a data source, for instance a view. With the Software Factory, you can automatically generate these views with a dynamic concept. In this post we will show you how, by creating a view that returns the column-translations for every language in your project.

To create a view for your report labels, you first need to model a view with an appl_lang_id column as the primary key and the required labels as columns. The name of the view will have a specific prefix (rpt_lbl_), to be able to recognize the report label views in our dynamic concept. Set the creation method of the view to Template.

Now we can add the dynamic control procedure to generate the template for all report label views. Add a control procedure, set the assignment type to SQL and the code group to Views.

Then insert the following code:

declare @prefix varchar = 'rpt_lbl_'

-- Insert prog object item for every report label view

insert into prog_object_item
'view_' + t.tab_id,
from tab t
where t.project_id = @project_id
and t.project_vrs_id = @project_vrs_id
and t.tab_id like @prefix + '%'
and t.type_of_table = 1 --View
and t.create_view_method = 2 --Template

-- Insert parameters


The full code is available in the attachment.

This control procedure will add a template to every program object for views that start with @prefix and creates the required parameters.

Now add a template with the same name as the control procedure to this control procedure, with the following code:

select *
from (values
) as transl (

After generating the view code will look like this:

select * 
from (values
( 'DE'
,( 'ENG'
,( 'NL'
) as transl (

Use this view in your report, filter by the required appl_lang_id, drag the fields on your report and off you go!




0 replies

Be the first to reply!