Process Mapping Logo

Process Mapping - Forums

Sharing 19 years of knowledge and experience

 
Metastorm BPM forums
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
rfromm

Member
Registered:
Posts: 32
Reply with quote  #1 
I have an editable grid, based on an external table, in a input form. I want to default a field in the grid to the forms efolderid, so I can pick up the correct rows when the form is re opened, is this possible?
Else how do I link the two tables together, looked at constraints but cannot get them to work either.

suggestions please

__________________
Rosemary
v 7.5 - still waiting for an updated version....
0
BMellert

Guru
Registered:
Posts: 688
Reply with quote  #2 

We accomplish this with an OnCellBlur client side script on the grid.  (Couldn't get the "code" tags to work below, so made the text blue instead.)

For example, the client extension of the Do this of the grid of our form:
OnCellBlur=CellBlur("Matter", "A", "002", "gridAdverseParties")&Language=JScript

And the client side script itself.  We optionally set additional data after setting the eFolderID and getting the current row.  You don't have to have parameters, but we set additional values in this case.

function CellBlur(RelatedTo,Role,RPType1,gridName)
{
  //called on exit from any editable cell
   // code grid columns
  var curCodeRowCount=0;
  // get folder ID and current row and column number
  var curFolderID = eworkGetField ("FolderID", "");
  var curItemRow = eworkGetCurrentRow (gridName);
  //set folder ID into hidden column
  eworkSetCell(gridName, 1, curItemRow, curFolderID);
  if (RelatedTo != "")
  {
    eworkSetCell(gridName, 2, curItemRow, RelatedTo);
    eworkSetCell(gridName, 5, curItemRow, Role);
    eworkSetCell(gridName, 4, curItemRow, RPType1);
  }
}

(Thinking about this, it would have been more proper to pass in the folder ID instead of pulling from a field, but the basic concept it still correct.)
0
rfromm

Member
Registered:
Posts: 32
Reply with quote  #3 
I will try something out along these lines and report back, thanks
__________________
Rosemary
v 7.5 - still waiting for an updated version....
0
rfromm

Member
Registered:
Posts: 32
Reply with quote  #4 
no good I cannot get the editable grid to show the input properly, so no use
__________________
Rosemary
v 7.5 - still waiting for an updated version....
0
BMellert

Guru
Registered:
Posts: 688
Reply with quote  #5 
I admit that the fields we are setting are hidden to the user, but they do get posted to the database.  Not sure if anything special is needed (a refresh perhaps) to get visible cells to show values added this way.  Perhaps others know.
0
rfromm

Member
Registered:
Posts: 32
Reply with quote  #6 
I have got the editable grid to take the transferred eFolderID as I wanted, but cannot get it to insert a new record, the manual says use Cntrl + Insert but this does not appear to have any effect. What should happen? I was expecting a new blank Row to appear in the Grid.
I can get the Cntrol + Delete to work and delete a record though.
I tried looking at the help file, which states that the fields cannot be Required usage type, strange, but not much else about them.
anyone help please?


__________________
Rosemary
v 7.5 - still waiting for an updated version....
0
rfromm

Member
Registered:
Posts: 32
Reply with quote  #7 
I put in the OnCellBlur code as above, but it does not appear to be working, no errors, but the cells still remain NULL.
can anyone tell me why?

__________________
Rosemary
v 7.5 - still waiting for an updated version....
0
BMellert

Guru
Registered:
Posts: 688
Reply with quote  #8 
Quote:
Originally Posted by rfromm
I ... cannot get it to insert a new record, the manual says use Cntrl + Insert but this does not appear to have any effect. What should happen?

Starting with the basics, the grid does allow inserts, correct?  (Insert checked on the Do this tab of the grid properties.)

I just press insert (not ctrl-insert) on my keyboard and a new blank line appears.
0
rfromm

Member
Registered:
Posts: 32
Reply with quote  #9 

yes I have tried just pressing insert, it does not work, and now the code has stopped copying over the folderid and accountno as it did before.
I seem to be going round in ever decreasing circles....
suspect that it will not insert a new row because the current one is not complete in some way - probably because the code is not updating the folderid and accountno.
my code which is based on yours is called as
OnCellBlur=GridDefault (Grid1)&Language=JScript which calls
function GridDefault(GrdName)
    {//called from grid do this for grid on form Missing Payments
     //code to fill in default values to grid rows
     var curCodeRowCount = 0
     // get folderID and current row and column Number
     var curFolderID=eworkGetfield("FolderID","");
     var curAccountNo=eworkGetfield("txtAccountNo","");
     var curItemRow=eworkGetCurrentRow (gridName);
     //set folderID into column
     eworkSetCell(gridName,1,curItemRow, curFolderID);
     eworkSetCell(gridName,9,curItemRow, curAccountNo); // sets accountno to form accountno

     }
I know this did work for a while, but now does not, but do not know what changed.
sorry code is not my forte.


__________________
Rosemary
v 7.5 - still waiting for an updated version....
0
rfromm

Member
Registered:
Posts: 32
Reply with quote  #10 
just realised that metastorm is not calling the function at all, the error is in the code calling it, but what?
__________________
Rosemary
v 7.5 - still waiting for an updated version....
0
BMellert

Guru
Registered:
Posts: 688
Reply with quote  #11 
The parameter for your grid is GrdName, but in your eworkSetCell you have gridName.  The names do not match, so that is at least part of the problem (why values aren't being assigned).  OnCellBlur only triggers when you leave a cell (switch cells, rows, or leaving the grid).

Not sure what to say about the insert key though.  Which browser are you using?
0
rfromm

Member
Registered:
Posts: 32
Reply with quote  #12 

the code never seems to trigger, have tried entering the grid and exiting it, tab around the cells etc. still no go.
the field types are the same, nvarchar(8) for accountno and varchar(50) for the folderID field.
no error message onscreen or in the service manager diagnostics.
I cannot attach the file - company policy blocks it.
the insert code is called from a button(When button pressed).
var startRow;
var rowsToAdd;
var maxNumber;

function AddRows()
{
    rowsToAdd=eworkGetField("NoPayments");
    startRow=eworkGetRowCount("Grid1");
    if(startRow is null) then startRow =0
    maxNumber=parseInt(eworkGetCell("Grid1",2,startRow-1));
    for (var i=0;i<rowsToAdd;i++)
    {
        InsertRow("Grid1");
        //add some data to ensure the next row can be added also
        var eventId=eworkGetField("eFolderID","");
        var curAccountNo=eworkGetfield("txtAccountNo",""); 
        eworkSetCell("Grid1",1,i+startRow,eventId);
        eworkSetCell ("Grid1",9,i+startRow,curAccountNo);
    }
    setTimeout("AddData()",100);
}

function AddData()
{
    for(var i=0;i<RowsToAdd;i++)
    {
        //event ID
        var eventID=eworkGetField("iId");
        eworkSetCell("Grid1",1,i+startRow,eventID);
        //AccountNo
        var AccNo=eworkGetField("txtAccountNo");
        eworkSetCell("Grid1",9,i+startRow,AccNo);
    }
}
this produces an error onscreen of 'Engine exception:Failed to fresh form' in the diagnostics it says 'Conversion from text to Boolean failed: Type mismatch.. Position 28'
but I cannot see a boolean value anywhere within the code.
InsertRow code is
     function InsertRow( sGridName )
     {
        var LeworkGrid=eworkData.FieldByName(sGridName);
        if( LeworkGrid.AllowInserts && LeworkGrid.IsCurrentRowComplete()&& LeworkGrid.State !=dsInsert)
        {
            DeletingRecord = false;
            LeworkGrid.Dataset.AddNew();
            event.srcElement.blur();
            event.returnValue = false;
        }
     }
the grid is called Grid1, set as an Edit with Insert and Delete ticked.
1st column = FID
9th column = txtAccountNo
both are optional fields, as are all the others.
thanks


__________________
Rosemary
v 7.5 - still waiting for an updated version....
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:


Create your own forum with Website Toolbox!