dw delete record problem

I am working on one project in PB 9.0 and I am getting one problem in deleting records in a DW.

I am retrieving data in a DW based on the search criteria. I am also adding and deleting records in the DW. I don't want to let the user modify the previously retrieved records in the DW. User can only modify newly added records. So i have set the protect property for one editable column to false/true using expression. It is working fine while adding records but in case of delete it is not working.

After inserting new record to the DW control moves to the editable column in the new row. If i give valid data it accepts it and again set focus to the same column and row. And hence i am not able to delete other records in the DW. If i try selecting other rows it does not moves the focus to that row. Even I click anywhere in the window it not moving focus out of the editable column and hence i can not select another row that i want to delete. The row status is set to NewModified. The code for searching and populating data in other columns for the newly added code is written in itemchanged event. the event returns 2 when successful.

Please tell how I can handle this problem. What code/property setting i have to write so that i can delete other records after adding new records. I tried lots of options the whole day but coulden't get rid of this problem.

Please reply ASAP. It is very very urgent for me. Please reply at the earliest.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If the row clicked on is protected then you need to do a SetRow to the protected row in order to make it the current row.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

Normal is it so, You can add a new row with InsertRow() function. Now you can add a new record to this row. You can always select a new row. You can always delete a selected row.
Please try to check your script if your are selecting row with SELECTROW() function then it is working properly. In the clicked event:

dw_1.SelectRow(0, FALSE)
dw_1.SelectRow(row, TRUE)

Please look if you used somewhere Modify() function for new added row as taborder > 0 and others 0.

The protection setting of a column. The Protect property overrides tab order settings. When a column is protected, the user cannot edit it even if the column's tab order is greater than 0.

If you want to delete then in the clicked event with the help of Modify function set the protection to false for the selected columns in the selected row and then delete this row.

Use the modify() to set the protection to false for the column of the selected row. If you have any question please let me know.

dw_1.Modify("column_name.protect='0~t if(column_name.protect=1,0,1'")

This is just a demostration. Please read once help (modify() for datawindow and script the right one as you need.

Best regards

How about setting the protection based on IsRowNew() expression function?

ls_Protect = "0~tif(IsRowNew(),0,1)"
dw_1.Modify("mycolumn.Protect='" + ls_Protect + "'")
This way, only retrived columns get protection, and anything with NewModified! or New! DWItemStatus will be left for modification.
I'm in...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.