Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#812388
Hi,

1) we're trying to generate an output document for a very long summary dynaform (that contains 10 smaller forms). We need to visualize the data (variables) in 2 columns (about 5 forms for each) but I don,t understand why it won't display in my generated document.
I added <div style="float:left; width:50%;" and it works great in the document editor but when I generate it, it's still in one column (5 pages so it's too long). Any easy way to do this ?

2) Also, there is about 100 variable fields. I'm trying to hide or put N/A or just hiding the variable when it's empty. Any way to do that programmatically? I don't want to set another variable for example to append the label + value and put this new variable in my output document.

So far, I have:
Code: Select all
$caseId = @@APPLICATION;
$c = new Cases();
$aCase = $c->LoadCase($caseId, @%INDEX);
$aVars = $aCase['APP_DATA'];
foreach($aVars as $key => $var)
{
	if($var == null || $var == "")
	{
		@@a = 1;
		$baseClass = new BaseCLASS();
		$baseClass->setByName($key, "N/A", "BasePeer::TYPE_PHPNAME");
	}
	else
		@@a = 0;
}

I thought that the function setByName could help since I'm in a foreach with my variable name stocked in $key each iteration. But this doesn't seem to be the right syntax for this function/class since I get a blank Dynaform.

Thanks
#812390
If you want to create two columns in your Output Document, then DIVs won't work. You can do it with an HTML table like this:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style>
.column {    
    width: 50%;
    valign: top;
}
<style>
</head>
<body>
<table>
<tbody>
<tr>
 <td class="column">
 <p><b>First Name:</b> @#firstName</p>
 <p><b>Last Name:</b> @#lastName</p>
 <p><b>Email Address:</b> @#email</p>
 <p><b>Cell number:</b> @#celNumber</p>
 <p><b>Address:</b><br>@#address</p>
</td>
<td class="column">
 <p><b>Special Needs:</b><br>@#specialNeeds</p>
 <p><b>Comments about Client:</b><br>@#commentsAboutClient</p>
</td>
</tr>
</tbody>
</table>
</body>
</html> 
Unfortunately there is no overflow from one column to the next column. I'm not if there is any way to do it with HTML.
#812400
amosbatto wrote:If you want to create two columns in your Output Document, then DIVs won't work. You can do it with an HTML table like this:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style>
.column {    
    width: 50%;
    valign: top;
}
<style>
</head>
<body>
<table>
<tbody>
<tr>
 <td class="column">
 <p><b>First Name:</b> @#firstName</p>
 <p><b>Last Name:</b> @#lastName</p>
 <p><b>Email Address:</b> @#email</p>
 <p><b>Cell number:</b> @#celNumber</p>
 <p><b>Address:</b><br>@#address</p>
</td>
<td class="column">
 <p><b>Special Needs:</b><br>@#specialNeeds</p>
 <p><b>Comments about Client:</b><br>@#commentsAboutClient</p>
</td>
</tr>
</tbody>
</table>
</body>
</html> 
Unfortunately there is no overflow from one column to the next column. I'm not if there is any way to do it with HTML.
Thanks for that , it worked.
#812406
As for setting the case variables to "N/A", your work won't work very well because the variables are not yet initialized.

You can use this code:
Code: Select all
//get case variables
$caseId = @@APPLICATION;
$c = new Cases();
$aCase = $c->LoadCase($caseId, @%INDEX);
$aCaseVars = $aCase['APP_DATA'];

//get variables for process:
$g = new G();
$g->LoadClass('xmlfield_InputPM');
$aVars = getDynaformsVars(@@PROCESS);

foreach ($aVars as $aVar) {
    $varName = $aVar['sName'];
    if ($aVar['sType'] == 'string' and !isset($aCaseVars[$varName])) {
        $aCaseVars[$varName] = 'N/A';
    }
}

$aCase['APP_DATA'] = $aCaseVars;
$c->updateCase($caseId, $aCase); 
You can't set this trigger to fire before an Output Document step because ProcessMaker won't execute it (this seems to be a bug in PM 3.2.1).
Also don't set it to fire after a DynaForm step, because any changes to the case's variables will be overwritten.
#812411
I played with this a bit more. This trigger code can be used after a DynaForm step:
Code: Select all
$caseId = @@APPLICATION;

//save variables from the DynaForm that just got submitted:
$aRecentVars = array(
    'myVar1' => @=myVar1,
    'myVar2' => @=myVar2
);
PMFSendVariables($caseId, $aRecentVars);

//get case variables
$c = new Cases();
$aCase = $c->LoadCase($caseId, @%INDEX);
$aCaseVars = $aCase['APP_DATA'];

//get variables for process:
$g = new G();
$g->LoadClass('xmlfield_InputPM');
$aVars = getDynaformsVars(@@PROCESS);

foreach ($aVars as $aVar) {
    $varName = $aVar['sName'];
    if ($aVar['sType'] == 'string' and !isset($aCaseVars[$varName])) {
        $aCaseVars[$varName] = 'N/A';
    }
}

PMFSendVariables($caseId, $aCaseVars); 
The only problem is if the DynaForm sets a variable, then it still hasn't been saved to the database, so this code will overwrite it, so you have to save the variables from the DynaForm at the start.

The market for cryptocurrencies is demonstrating a[…]

What's SAP FICO?

Embarking on a dissertation can be one of the most[…]

Hello. For rental housing, there are software solu[…]

Experience heightened pleasure with Cenforce 100 M[…]