Problem with removing department from Business Drivers RRS feed

  • Question

  • I created a business driver and selected two departments to associate
    it to. I am trying to create a "remove" action to programmatically
    remove one of the associations based on where I'm accessing the
    remove from (so I'm not exposing the departments field at that

    Removing DriverDepartmentsRow from DriverDataSet doesn't seem to work.
    I've tried:
    •    DriverDataSet.DriverDepartmentsRow.Delete() then
    •    DriverDataSet.DriverDepartments.RemoveDriverDepartmentsRow(deptRow)
    then DriverDataSet.AcceptChanges()
    •    Called the DriverClient.UpdateDriver(DriverDataSet)

    I've verified the count and contents of
    DriverDataSet.DriverDepartmentsRow.Rows to be 1 less after I do the
    remove/delete but when I re-query the row I removed is back. Is
    there another "commit" I am missing?

    Tuesday, February 9, 2010 4:07 PM


All replies

  • Hey,

    Can you privde a code snippet to repro the issue?


    Thursday, February 11, 2010 1:10 AM
  • Hi Chris,

    SvcDriver.DriverClient driverClient = PSIRouter.getServiceInstance<DriverClient>(_pwaUrl);
    driverClient.ChannelFactory.Credentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;

    SvcDriver.DriverDataSet dsDriver = new SvcDriver.DriverDataSet();
                        dsDriver = driverClient.ReadDriver(driverUid);

                        //driverDataSet.DriverDepartments.FindByDRIVER_UIDDEPARTMENT_UID(driverUid, portfolioDept).Delete();
                        Log.MainLog.Debug("===>Before remove - driverDataSet.DriverDepartments.Rows.Count: " + dsDriver.DriverDepartments.Rows.Count);
                        SvcDriver.DriverDataSet.DriverDepartmentsRow deptRow = dsDriver.DriverDepartments.FindByDRIVER_UIDDEPARTMENT_UID(driverUid, portfolioDept);
                        Log.MainLog.Debug("===>Found deptRow: " + deptRow.DEPARTMENT_NAME);
                        Log.MainLog.Debug("===>After remove before update - driverDataSet.DriverDepartments.Rows.Count: " + dsDriver.DriverDepartments.Rows.Count);

    I commented out the AcceptChanges() in the code (one at a time) but I've also brought them in before the UpdateDriver() but that throws a concurrent update exception.  After this snippet I re-set the dsDriver to do another driverClient.ReadDriver(driverUid) call but the dsDriver.DriverDepartments.Rows.Count is back up to the count before the remove.

    Thursday, February 11, 2010 4:04 AM
  • Hey,

    Try row.delete() instead of RemoveDriverDepartmentRow.

    Friday, February 12, 2010 4:04 AM
  • Chris,
    Sorry I commented it out of the snippet but I also tried row.delete() instead of RemoveDriverDepartmentRow (see original message) and it did not work.

    Friday, February 12, 2010 6:21 PM
  • Hey,

    Try row.delete() instead of RemoveDriverDepartmentRow.

    Could you give more details?
    Friday, January 21, 2011 6:11 AM