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.
#825653
Hi,

I would like to set the country control in a grid to the country of the user using the process. I have the following trigger that runs before the dynaform:

$aUser = PMFInformationUser(@@USER_LOGGED);
@@Country = $aUser['country'];

Now I create a text control with the value of @@country in the dynaform where the grid variable is, and I try to set the control in the grid as follows:
Code: Select all
var grid=$("#branchGrid");
var rows=grid.getNumberRows();

for (var i=1; i <= rows; i++) 
{
  var sVal = $("#Country").getValue();
  alert(sVal);
  grid.setValue(sVal, i, 2);
  alert(grid.getValue(i, 2));
}
$("#Country").hide()
This however does not set the control in the grid when running a case. Please could someone help. Also I would like this control to be set even when a new row is added.
#825661
Your @@Country variable has the two letter ISO code for a country, so the dropdown box to select the country needs to have the following SQL:
SELECT '', '--select--'
UNION
SELECT IC_UID, IC_NAME FROM ISO_COUNTRY


Then you can use this JavaScript code:
Code: Select all
var oGrid = $("#branchGrid");
var rows = oGrid.getNumberRows();
var usersCountry = $("#Country").getValue();
$("#Country").hide()

//set empty country dropdown in the grid rows when the Dynaform loads:
for (var i=1; i <= rows; i++) {
  var country = oGrid.getValue(i, 2);
  if (country == '') {
     oGrid.setValue(usersCountry, i, 2);
  }
}

//set country when new rows are added:
oGrid.onAddRow( function(aNewRow, oGrid, rowIndex) {
  oGrid.setValue(usersCountry, i, 2);
});
What's SAP FICO?

Trustworthy and skill-building, each of these actu[…]

To convert MBOX to PST, start by downloading and i[…]

My Assignment Services stands out as one of the be[…]

Erectile Dysfunction, commonly known as impotence,[…]