ProcessMaker code contributions
By sabinsunny
#789985
Hi Team,

Please help Me,
i create a dyana form with some field what i need is i need to add all data i filled in form to grid.
once i added the forms must clear

here i attaching my two forms original php form and dyna form
Attachments
original form.jpg
PHP Form
original form.jpg (214.95 KiB) Viewed 45112 times
material.jpg
Dyna Form
material.jpg (115.9 KiB) Viewed 45112 times
User avatar
By amosbatto
#789994
I have prepared an example DynaForm which has JavaScript code to do this:
(8.61 KiB) Downloaded 1022 times
The Dynaform has the following fields:
AddRowToGridForm.png
AddRowToGridForm.png (22.9 KiB) Viewed 45106 times
The fields have the following IDs:
Code: Select all
1. Text: clientName
2. Dropdown: typeOfService
3. Checkbox: hasContract
4. Datetime: contractStartDate
5. Button: addToList
6. Button: clearList
7. Grid: clientsList
   with the following fields:
   1. Text: clientNameList
   2. Dropdown: typeOfServiceList
   3. Checkbox: hasContractList
   4. Datetime: contractStartDate
Then, add the following JavaScript to the DynaForm:
Code: Select all
$("#addToList").click( function() {
  var client = $("#clientName").getValue();
  var service = $("#typeOfService").getValue();
  var hasContract = $("#hasContract").getValue();
  var startDate = $("#contractStartDate").getValue();
  if (client == '') {
    alert("Please add a client name");
    return;
  }
  else if (hasContract == "1" && startDate == '') {
    alert("Please set the Contract Start Date");
    return;
  }
  
  var aData = [
    {value: client},
    {value: service},
    {value: hasContract},
    {value: startDate}
  ];    
  $("#clientsList").addRow(aData);

  //clear form:
  $("#clientName").setValue('');
  $("#typeOfService").setValue('');
  $("#hasContract").setValue('0');
  
  //workaround for clearing date fields:
  $("[id='form[contractStartDate]']").val('');
  $("[id='form[contractStartDate_label]']").val('');
  getFieldById("contractStartDate").model.attributes.data.label='';
  getFieldById("contractStartDate").model.attributes.data.value='';
});

function deleteList() {
  var oGrid = $("#clientsList"); //set to the ID of the grid
  var iRow = oGrid.getNumberRows();
  for (; iRow > 0; iRow--) {
     oGrid.deleteRow(iRow);
  }
}

$("#clearList").click(deleteList); //clear grid when clicking "clearList" button
deleteList(); //clear grid when the Dynaform loads
When the user clicks on the "clearList" button, the click event handler for the button checks whether the "clientName" textbox is empty and displays a message telling the user to fill the field. Likewise, if the user has marketd the "hasContract" checkbox, then the event handler checks whether the "contractStartDate" field is filled. There is a workaround to clear date fields, which won't be necessary in version 3.2 and later.
By sabinsunny
#790056
hi,

now i can add data to grid view but in the next dynaform it not loading the data which i added in the grid,

first process adding data to grid in next level need to get appproval in approval form the grid value not loading

IF i manually adding data in the grid it shows on the next user
By mishika
#790070
Hello,

To avoid this problem, please make sure that you are not using any javascript in your second form which clears the grid data.
Like, if you have imported your first Dynaform again in the second Dynaform to verify, make sure you have modified the javascript that has come along with the Dynaform.
You can refer to the process I have attached below, which has 2 tasks where the first task has the Dynaform which gets the grid filled up and the second task has the Dynaform which verifies the grid data.

Hope this helps

Best Regards
Mishika
Attachments
(45.23 KiB) Downloaded 879 times
User avatar
By amosbatto
#790089
Remove this line from the JavaScript so that it doesn't automatically clear the grid:
Code: Select all
deleteList(); //clear grid when the Dynaform loads
It helps to read the code and try to understand what it is doing. ;-)
By sabinsunny
#790128
i found that the issue is i uncheck the add row and delete row properties from grid properties now its working but not able to gemerate the value with grid
and i need support for report table and retrieve data to another form from report table
By zainab
#790133
Hello,

What support do you require regarding Report tables?

Kindly elaborate your scenario and we will help you with a solution.

Best Regards,
Zainab Sabunwala
By sabinsunny
#790141
Hi Team,

i have one process for creating material request, in that form i have one grid form am adding all data to that grid and sending to next user with the same table.

in next user he will create material request in SAP software and he will update the table with status is "closed".

process flow MATERIAL REQUEST --------------> SAP TEAM.

1) need to generate pdf with grid values (SAP TEAM)
2) need to store all data in report table (SAP TEAM dynaform)
3) need a form to view all my request and other request details also
Attachments
(24.58 KiB) Downloaded 808 times
(6.58 KiB) Downloaded 817 times
123.png
Material REquest FORM
123.png (46.19 KiB) Viewed 45002 times
1.jpg
SAP TEAM FORM
1.jpg (70.28 KiB) Viewed 45002 times
By zainab
#790142
Hello,

For the first request, you can create an Output Document, and assign it after the second dynaform. Edt your Output document with the HTML editor and include the below code to display the grid along with the values:
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>
</head>
<body>
<p align="center">SAP Report</p>
<p align="center"><span>@#creator_name @#employee_code </span></p>
<p align="left"></p>
<table cellspacing="0" border="1">
<tbody>
<tr><th>SAP Material Code</th><th>Material Description</th><th>Quantity</th><th>Unit</th><th>Building Name</th><th>Site</th><th>Parts</th><th>Floor</th><th>Note</th><th>Status</th></tr>
<!--@>gridVar-->
<tr>
<td>@#sapmc</td>
<td>@#materialdesc</td>
<td>@#Quantity</td>
<td>@#unit</td>
<td>@#buildingname</td>
<td>@#Site</td>
<td>@#Parts</td>
<td>@#Floor</td>
<td>@#Note</td>
<td>@#dropdown0000000001_label</td>
</tr>
<!--@<gridVar--></tbody>
</table>
</body>
</html>
In the settings of your Output Document, set the Properties according to your requirement, for example select .pdf if you want your Output document only in PDF format.

For your second requirement, it is better to create a separate PMT table in the database to store the grid values than using a Report table. Since grids contain multiple values, it is not easy to directly store grids in Report tables. The workaround for this would be to create a table PMT_SAPREPORT containing the fields of the grid along with the APP_UID which would store the Case Id. Then create the following trigger in your process, and set it to fire after the second task to store the values in database:
Code: Select all
$grid = @=gridVar;
foreach($grid as $row)
{
	$app = @@APPLICATION;
 $sapmc = $row['sapmc'];
	$material = $row['materialdesc'];
	$quantity = $row['Quantity'];
	$unit = $row['unit'];
	$building = $row['buildingname'];
	$site = $row['Site'];
	$parts = $row['Parts'];
	$floor = $row['Floor'];
	$note = $row['Note'];
	$status = $row['dropdown0000000001_label'];
	@@insert = executeQuery("INSERT INTO PMT_SAP(APP_UID,SAP,MATERIAL,QUANTITY,UNIT,BUILDING,SITE,PARTS,FLOOR,NOTE,STATUS) VALUES ('$app','$sapmc','$material','$quantity','$unit','$building','$site','$parts','$floor','$note','$status')");
}
If you want to store data from other fields, you can include them as well.

Please let us know if you have further doubts.

Hope this helps.

Best Regards,
Zainab Sabunwala
By sabinsunny
#790147
wow thanks its working but when i add trigger am getting error mysql stoped and not able to restart then i need to restore the PM Backup

in the report database i need to add
1
case no
2
project name , serial no, project)no, date of creation , and the pdf
By mishika
#790219
Hello,

Yes, it is possible to fetch the data from Report table for the current case. There are certain points to be kept in mind:

1. The entry in a Report table for the case is created in the first task before routing. So, if you want to fetch the data for the current case in the first task, you can access it using the system variable @@APPLICATION(using the table APPLICATION from the database) instead of getting it from the Report table.
2. To fetch data from Report table before Dynaform, you can create a trigger which runs a SELECT query in the report table and gets the data in a variable of the process. This trigger can be placed before the Dynaform and the variable which has been used to store the table's data can be used directly in the Dynaform. You can refer the following trigger:
Code: Select all
$query = "SELECT * FROM PMT_GRIDS";
@@res = executeQuery($query);
@@appnumber = @@res[1]['APP_NUMBER'];
3. Also, you will get the Case number, Case status, and Case UID from the Report table and not the Case creator's name.
So, you can use the APPLICATION table to do so (column APP_INIT_USER).

Hope this helps

Best Regards
Mishika
By sabinsunny
#790232
hi team, thanks for supporting me,

my idea is simple i need to create a process for report view
in dyna form i need to load all data grid
like case no case creator app_status ..etc

i tried with simple sql code its working but issue the code is loading only one row values i have 100 rows in my report table
By mishika
#790234
Hello,

To achieve your requirement, please refer the process I have attached here.
The process has the following:
1. A report table which includes all the field of a Dynaform in the process.
2. Another Dynaform has a grid which displays the data from the report table.
3. A trigger which fires a SQL query to fetch the data from the report table from the database.
Make sure that the column Id of the grid is same as the field names in your report table. You can also use the alias to do so.
If the field names are different than the column ids, the array fetched from the SQL query will not match to the grid's value.

Hope this helps

Best Regards
Mishika
Attachments
(38.46 KiB) Downloaded 1028 times
By rachelgomez123
#830275
I think you should use datatable. Prepare your datatable as per your need and bind this datatable to your grid view here is the example of C# but you can do same thing with syntax of VB.NET

DataTable dt = new DataTable();
dt.Columns.Add("sr_no");
dt.Columns.Add("item_name");
dt.Columns.Add("item_id");
dt.Columns.Add("qty");
dt.Columns.Add("rate");
dt.Columns.Add("total");

var dr = dt.NewRow();
dr["sr_no"] = txtSr.Text;
dr["item_name"] = ddlItem.SelectedItem.Text;
dr["item_id"] = ddlItem.SelectedValue;
dr["qty"] = txtQty.Text;
dr["rate"] = txtRate.Text;
dr["total"] = int.Parse(txtQty.Text) * int.Parse(txtRate.Text);

dt.Rows.Add(dr);

Regards,
Rachel Gomez

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]