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:
1declare @prefix varchar = 'rpt_lbl_'23-- Insert prog object item for every report label view45insert into prog_object_item6select7 @project_id,8 @project_vrs_id,9 'view_' + t.tab_id,10 @control_proc_id,11 100,12 @control_proc_id,13 @control_proc_id14from tab t15where t.project_id = @project_id16 and t.project_vrs_id = @project_vrs_id17 and t.tab_id like @prefix + '%'18 and t.type_of_table = 1 --View19 and t.create_view_method = 2 --Template2021-- Insert parameters2223...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:
1select *2 from (values3 [open]'[transl]'[close]4) as transl (5 [comma][col]6)7After generating the view code will look like this:
1select * 2from (values3 ( 'DE'4 ,'Land'5 ,'Stadt'6 ,'Adresse'7 ,'€')8 ,( 'ENG'9 ,'Country'10 ,'City'11 ,'Address'12 ,'£')13 ,( 'NL'14 ,'Land'15 ,'Stad'16 ,'Adres'17 ,'€')18) as transl (19 appl_lang_id20 ,country21 ,city22 ,address23 ,currency24)Use this view in your report, filter by the required appl_lang_id, drag the fields on your report and off you go!



