using openTBS (in the SugarCRM plugin MailMergeReports) and I have the following in my Word template.
[a_sub5;block=w:p;nodata] No States
[a_sub5;block=w:p][a_sub5.name]
This works fine as far as it goes - it outputs a single state name per line - which is fine when the data only has a few states.
The problem is I want it to output the list of states as a comma separated string rather than 1 state per line. I have tried multiple options with no luck! Is this not possible to do? or am I just missing the obvious syntax needed to accomplish it.
Note: because I am using TB via a 3rd party plugin to SugarCRM CE I do not have ready access to the PHP code. I need a solution that can be accomplished just within the template specification.
If you had no the nodata
section, you could try with [a_sub5.nom;block=!w:r],
but this would add an extra coma at the end of the list. This doesn't work since you have the nodata
section because the 2 TBS sections are not continuous, thus it will produce an invalid XML.
My advice is to format your list at the TBS side, then merge it into the template :
PHP :
$list = array_column($data, 'name');
$list = implode(', ', $list);
if ($list == '') $list = "No States";
TBS->MergeField('a_sub5', $list);
Template:
[a_sub5]
If is a sub-block, then you can use a onformat custom function for making the list.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.