dw delete record problem

Posted on 2004-10-30
Last Modified: 2013-12-26

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.

Question by:mayuri25
    LVL 5

    Accepted Solution

    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.
    LVL 4

    Assisted Solution


    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

    LVL 4

    Assisted Solution

    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.
    LVL 4

    Expert Comment

    I'm in...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Learn The Basics of Ethical Hacking & Pen Testing

    Computer and network security is one of the fastest growing and most essential industries in technology, meaning companies will pay big bucks for ethical hackers. This is the perfect course to leap into this lucrative career, learning how to use ethical hacking to reveal ...

    Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
    Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    856 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now