Questions and discussion about using ProcessMaker: user interface, running cases & functionality

Moderator: amosbatto

#824031
Hoping you can help on hiding rows if the variables do not have values. Here's the HTML code of the report:


<table border="0" cellspacing="0" style="width: 420px; height: 47px;">
<tbody><[email protected]>GRID_BORROWER-->
<tr>
<td style="height: 1px; font-size: 9.0pt;"><font face="arial,helvetica,sans-serif"><b>@#BORROWER_NAME</b></font></td>
</tr>
<[email protected]<GRID_BORROWER--></tbody>
<tbody>
<tr>
<td style="height: 1px; font-size: 9.0pt;"><font face="arial,helvetica,sans-serif"><b>TRADE NAME:&nbsp;@#BORROWER_TRADE</b></font></td>
</tr>
<tr>
<td colspan="12" style="height: 1px; font-size: 9.0pt;"><font face="arial,helvetica,sans-serif">@=BORROWER_ADDR</font></td>
</tr>
</tbody>
</table>


Found a way on how to hide a row but I have no idea how to put conditions to check if the variable has a value or null.
<tr style="display:none"><td>@#BORROWER_TRADE</td></tr>
#824042
The only way to do this is to dynamically generate the HTML code for the table inside a trigger and then insert the variable holding the HTML code inside your template.

Your trigger code would be something like this:
Code: Select all
@@tableContent = '<table border="0" cellspacing="0" style="width: 420px; height: 47px;"><tbody>';
foreach (@=myGrid as $aRow) {
    if (trim($aRow['myField']) != '') {
       @@tableContent .= "<tr><td style=\"height: 1px; font-size: 9.0pt;\">{$aRow['myField']}</td></tr>";
    }
}
@@tableContent .= "</tbody></table>";
Set this trigger to fire before the Output Document.

Then, put @#tableContent in your Output Document template.
#825964
Hi Amos,

With this example, I would like the code to ignore the first row, is there a way I can do it? $aRow does not represent a number in a loop.

@@tableContent = '<table border="0" cellspacing="0" style="width: 420px; height: 47px;"><tbody>';
foreach (@=myGrid as $aRow) {
if (trim($aRow['myField']) != '') {
@@tableContent .= "<tr><td style=\"height: 1px; font-size: 9.0pt;\">{$aRow['myField']}</td></tr>";
}
}
@@tableContent .= "</tbody></table>";
#825993
Do it this way to skip the first row in the grid:
Code: Select all
@@tableContent = '<table border="0" cellspacing="0" style="width: 420px; height: 47px;"><tbody>';
for ($i=1; $i <= count(@=myGrid); $i++) {
    if ($i != 1 and trim(@=myGrid[$i]['myField']) != '') {
       @@tableContent .= '<tr><td style="height: 1px; font-size: 9.0pt;">'[email protected]=myGrid[$i]['myField'].'</td></tr>';
    }
}
@@tableContent .= "</tbody></table>";
#826040
Hi Amos,

It works but was not able to see what I want to solve.
I have dynamic columns, I have set the table for 7 columns and 5 rows and will only show columns with values. With the new code that you have provided, table automatically adjusts (maximizing the table width) if not all columns will be shown, unlike the 1st code that hides succeeding columns with no values.

Is there a way table width will not be responsive (or table width will not change automatically))? I just want to hide the 1st row if only 1 column will be shown :shock:
Code: Select all
$myGrid = @=GRID_CHM_NOTARY_MOTOR;
$GridRows = count($myGrid);

if (@@CHM_Motor>1) {
	$j=1;
} else {
	$j=2;
}

@@NotarytableContent3 = '<table style="width: 804px; height: 142px;"><tbody>';


for ($i=$j; $i <= $GridRows; $i++) {

	@@NotarytableContent3 .= "<tr><td style=\"font-family: arial; font-size: 9.0pt; width: 2%;\"></td>";
	
	@@NotarytableContent3 .= '<td style=\"border: 1px solid #808080; font-family: arial; font-size: 9.0pt; width: 20%;\">' . $myGrid[$i]['text0000000035'] . '</td>';
	
	if (trim($myGrid[$i]['text0000000036']) != '') {
		@@NotarytableContent3 .= '<td align=\"center\" style=\"border: 1px solid #808080; font-family: arial; font-size: 9.0pt; width: 10%;\">' . $myGrid[$i]['text0000000036'] . '</td>';
	}
		
	if (trim($myGrid[$i]['text0000000037']) != '') {
		@@NotarytableContent3 .= '<td align=\"center\" style=\"border: 1px solid #808080; font-family: arial; font-size: 9.0pt; width: 10%;\">' . $myGrid[$i]['text0000000037'] . '</td>';
	}
	
	if (trim($myGrid[$i]['text0000000038']) != '') {
		@@NotarytableContent3 .= '<td align=\"center\" style=\"border: 1px solid #808080; font-family: arial; font-size: 9.0pt; width: 10%;\">' . $myGrid[$i]['text0000000038'] . '</td>';
	}
	
	if (trim($myGrid[$i]['text0000000039']) != '') {
		@@NotarytableContent3 .= '<td align=\"center\" style=\"border: 1px solid #808080; font-family: arial; font-size: 9.0pt; width: 10%;\">' . $myGrid[$i]['text0000000039'] . '</td>';
	}
	
	if (trim($myGrid[$i]['text0000000040']) != '') {
		@@NotarytableContent3 .= '<td align=\"center\" style=\"border: 1px solid #808080; font-family: arial; font-size: 9.0pt; width: 10%;\">' . $myGrid[$i]['text0000000040'] . '</td>';
	}
	
	if (trim($myGrid[$i]['text0000000041']) != '') {
		@@NotarytableContent3 .= '<td align=\"center\" style=\"border: 1px solid #808080; font-family: arial; font-size: 9.0pt; width: 10%;\">' . $myGrid[$i]['text0000000041'] . '</td>';
	}
	
	@@NotarytableContent3 .= "</tr>";
}

@@NotarytableContent2.= "</tr></tbody></table>";
Attachments
AMOS Notary Table.jpg
AMOS Notary Table.jpg (56.3 KiB) Viewed 71 times

Sending documents as base64 worked the last time I[…]

I don't see those problems using PM 3.3.10 Communi[…]

Tengo el mismo problema con el MultipleFile, inten[…]

Getting this error

_ERROR_ : The row '3149943815d31b85fdf39650326697[…]