Categories > OpenTBS with DOCX >

single line merge

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: giuseppe
Date: 2014-05-13
Time: 11:33

single line merge

Hello
I am an openTBS beginner and trying to display on a MSWord document a comma separated list of item selected from an SQL database.

What I am looking for is to display :

France : Paris, Lyon, Brest, ...
Italy : Milan, Florence, Rome, ...
USA : NewYork, Boston, ...

I tried the following dynamic sub block template with no success :
[state.name;block=tbs:p] : [city.name;p1[state.id]]

My result is :

France :
Italy :
USA :

PHP script is :
$TBS->MergeBlock('state',$cnx_id,"SELECT id, name FROM state");
$TBS->MergeBlock('city',$cnx_id,"SELECT id, name FROM city WHERE state_id = '%p1%'");

Database table, relations and data are fine.

Thanks a lot for any advice.
ggi
By: Skrol29
Date: 2014-05-26
Time: 14:23

Re: single line merge

Hi Giuseppe,

First you should code
[city.name;p1=[state.id]]
Instead of
[city.name;p1[state.id]]

And then you have to define the bounds for the block "city", otherwise only the first record will be merged.
The bound of the block are defined using parameter "block".

By: giuseppe
Date: 2014-08-06
Time: 13:49

Re: single line merge

Thank you for correcting me. And with your suggestion now the issue is fixed
Ciao