Solved

Thinkstore - Maintenance of solutions

  • 17 May 2023
  • 1 reply
  • 63 views

Userlevel 5
Badge +16
  • Thinkwise Local Partner Brasil
  • 389 replies

Hi. 

A quick question on the status of the Thinkstore. 

Are solutions being maintained ? I was trying the translation solution, but it doesn't work. 

Based on this solution I was hoping on extending the functionality with custom translations, to get them into the end-product as well. 

 

Is there any additional documentation on managing code generation. With some more exemplary examples to create our own translation functions, including custom translations..  

https://docs.thinkwisesoftware.com/docs/sf/functionality#managing-code-generation-with-staging-tables

If I follow the SQL code from the Thinkstore example.. I really don't get the complete picture.  

icon

Best answer by Mark Jongeling 19 May 2023, 08:44

View original

This topic has been closed for comments

1 reply

Userlevel 7
Badge +23

Hi Freddy,

I see that the Thinkstore solution indeed has a problem. This might have to do with upgrading these solutions and the introduction of the Staged strategy. The control procedure code is not truly staged, but rather only using the strategy whilst using the wrong method of inserting data in the prog_object tables.

Here is the correct version, update the control procedure in the Thinkstore solutions' base model:

-- Determine of which type of objects we want to include the translations
declare @type_of_object table (type_of_object int)

insert into @type_of_object
values
(0), --tab
(1), --col
(2) -- dom_elemnt

-- Add the template to the program object
insert into #prog_object_item (
prog_object_id,
prog_object_item_id,
order_no,
template_id
)
values (
'func_tsf_translate',
'func_tsf_translate',
100,
@control_proc_id
)

-- Add the parameters for every translation object
insert into #prog_object_item_parmtr (
prog_object_id,
prog_object_item_id,
parmtr_id,
parmtr_value,
order_no
)
select
'func_tsf_translate',
'func_tsf_translate',
'appl_lang_id',
appl_lang_id,
row_number() over(order by appl_lang_id, type_of_object, transl_object_id)
from transl_object_transl
where model_id = @model_id
and branch_id = @branch_id
and type_of_object in (select type_of_object from @type_of_object)

insert into #prog_object_item_parmtr (
prog_object_id,
prog_object_item_id,
parmtr_id,
parmtr_value,
order_no
)
select
'func_tsf_translate',
'func_tsf_translate',
'type_of_object',
convert(varchar(10), type_of_object),
row_number() over(order by appl_lang_id, type_of_object, transl_object_id)
from transl_object_transl
where model_id = @model_id
and branch_id = @branch_id
and type_of_object in (select type_of_object from @type_of_object)

insert into #prog_object_item_parmtr (
prog_object_id,
prog_object_item_id,
parmtr_id,
parmtr_value,
order_no
)
select
'func_tsf_translate',
'func_tsf_translate',
'transl_object_id',
transl_object_id,
row_number() over(order by appl_lang_id, type_of_object, transl_object_id)
from transl_object_transl
where model_id = @model_id
and branch_id = @branch_id
and type_of_object in (select type_of_object from @type_of_object)

insert into #prog_object_item_parmtr (
prog_object_id,
prog_object_item_id,
parmtr_id,
parmtr_value,
order_no
)
select
'func_tsf_translate',
'func_tsf_translate',
'comma',
-- Use lead to check if it is the last value
case when lead(transl_object_id) over(order by appl_lang_id, type_of_object, transl_object_id) is null then '' else ',' end,
row_number() over(order by appl_lang_id, type_of_object, transl_object_id)
from transl_object_transl
where model_id = @model_id
and branch_id = @branch_id
and type_of_object in (select type_of_object from @type_of_object)

insert into #prog_object_item_parmtr (
prog_object_id,
prog_object_item_id,
parmtr_id,
parmtr_value,
order_no
)
select
'func_tsf_translate',
'func_tsf_translate',
'transl',
replace(transl, '''', ''''''),
row_number() over(order by appl_lang_id, type_of_object, transl_object_id)
from transl_object_transl
where model_id = @model_id
and branch_id = @branch_id
and type_of_object in (select type_of_object from @type_of_object)

 

I'll create a ticket for this to be corrected.