How to know which row in Multirow variable set is edited

asifnoor
Kilo Patron

Hi,

I have a multirow variable set on a catalog item. In the catalog item, once you select a specific Network value in a variable , i fetch the associated data and displaying them in multirow variable set.

So for 1 specific network, there can be rows anywhere between 5 to 20. In each row, we have 10 fields.

If user has edited 2 rows in these 20 rows, is there an easier way to find out which of the 2 rows are edited?

1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

Unfortunately there is no OOB Way solution for this.

So here is how i did it.

Create a variable (yes/no) field in a variable set.

Make this variable hidden on add/edit.

Whenever a row is edited, i have updated the edited value to yes.

Then in my workflow on task table, i have fetched all the variables and removed the entries which are not edited. Below is the code snippet that i have used to update the RITM with only the entries that are edited.

mrvs = current.variables.my_varset;
var rowCount = mrvs.getRowCount();
for(k=0;k<rowCount;k++) {
  var row = mrvs.getRow(k);
  if(row.edit_row!= "Yes") {
    row.deleteRow();
    rowCount = mrvs.getRowCount();
    //reinitialize the counter variable so that it checks again from beginning as the multirow variable set and rowcount gets updated on delete.
    k=-1; 
  }
}
//once all non edited rows are removed, update the multivarset bck to the record.
current.variables.my_varset= mrvs;

 

View solution in original post

12 REPLIES 12

Hi,

when you say "Whenever a row is edited, i have updated the edited value to yes." how do you find out if the row is edited. Do we need to compare new value and old value of all variables of each row?

Hi @Prity Kumari 

Yes, I think here they are comparing with newValue and oldValue of the variable.

@asifnoor Are you checking this in RITM level or in Catalog form?

I believe oldValue will be null of the variable until it has some default value in it.

 

Thanks,

Murthy

Thanks,
Murthy

Hi Asif,

 

I have a scenario that , there is a checkbox field which is when checked i need to populate the priority field as the row count. for example if the balance field of 10th row is checked priority should be 10