Skip to main content

Hi,

 

I have a editable list view (Employee), which refer EmpSO which has three columns (Empno, Ename and Deptno).

 

Deptno of the Employee view is the DropDownList, whose value is populating from DEpt SO.

 

While adding ,the drop down list of Deptno will display Dname, but while saving in Employee SO it will save the Deptno as a value.

 

But while saving, the last enterted Deptno is saving for all the Added rows of the employee.

 

Say in the first row of the editable list,  Dept selected as Sales (Deptno = 10) and for second row (which is last row) Dept is selected as Account (Deptno = 30). Now when data is saving, for both employee records are saving as Deptno = 30, where first record shoud have been 10 and next one should have 30.

 

It will be nice if you let me know the solution for the above issue.

 

Thanks with Regards,

JD

What does your rule look like for saving the data?  It sounds like it is mis-configured.

I'll assume you have some sort of for each condition with a Save/Create method.  When you use a foreach you want to use the properties of the SmartObject that is bound to the list view.  Each time you iterate the SmartObject will contain the values for the current row.

 

David


Hi David,

Yes, you are correct. There is 'for Added rows' loop has been used and inside that loop 'execute the Create method' is been mentioned.

 

And Create method initialy was configured as 'Input Properties -> Dept_key with ListView -> Controls  -> Add/Edit Row -> DeptDropDownList -> DeptSO -> DeptKey.

But while saving it was showing error : The following fields are required : DeptSO -> DeptKey.

 

Then, to avoid this error, while adding new row, the selected deptkey of dropdown list is maaped with a hidden parameter - DataLable (whish has difined in ListView) and in the Create method it has configurared that hidden parameter with DeptKey -  'Input Properties -> Dept_key with ListView -> Controls  -> Add/Edit Row -> Dtbl_DeptKey.

 

Now i am able to sava data, but as i said, all employee details are saving with same deptkey (the one which has entered in the last row).

 

Would be nice, if any one find any workaround of the above issue.

 

Thanks with Regards,

JD

 


There is an easy answer here.  When you look at the add/edit row in the designer, it looks like there is only one row, right?  That's because there is only one add/edit row!  That's why you are getting the same value each time.  Instead of mapping to "Input Properties -> Dept_key with ListView -> Controls  -> Add/Edit Row -> DeptDropDownList -> DeptSO -> DeptKey" map your Create method to the SmartObject that is bound to the list.  When you iterate through the list in a foreach, the SmartObject holds the value of the currently selected row.  

 

This holds true for any operation that needs to access the current row--use the SmartObject properties bound to the list.  


Reply