Question Not Able To Delete The Last Browser Record?

reynold12

New Member
Hello Everyone -

I have a Query defined as below and I need to delete some particular records in the grid/browser without modifying the Grid Filter criteria.
I am using the below way:
Code:
/************************************************/
OPEN QUERY q1 FOR EACH ttNumbers.
RUN remove_browse_records.

PROCEDURE remove_browse_records:
   DEFINE VARIABLE vRowid AS ROWID NO-UNDO.

   GET FIRST q1.
   DO WHILE AVAILABLE(ttNumbers):
      IF ttNumbers.nField = 1 OR ttNumbers.nField = 3 OR
         ttNumbers.nField = 5 OR ttNumbers.nField = 7 OR
         ttNumbers.nField = 9 THEN DO:
         vRowid = ROWID(ttNumbers).
         REPOSITION q1 TO ROWID vRowid.
         b1:SELECT-FOCUSED-ROW().
         b1:DELETE-SELECTED-ROWS().
      END.
      GET NEXT q1.
   END.
END PROCEDURE.
/************************************************/

But with this it's not deleting the last record of the result set, if that matches my condition (The problem is only happening if the Last record is also matching with condition, this above code is not deleting the Last record).
For the Browser properties I checked and for that Browse the Multiple-Selection is "unchecked".
and for the browser I really donlt want the Multiple selection.

But when I set in "Local-Initialize" the
{&BROWSE-NAME}:multiple in frame {&frame-name} = yes.
Then the above code works well i.e. it will be able to delete the last record as well if that matches the condition.

Could anyone help, what Can i do for that, as I don't want the Multiple selection for that Browser.

Can I again set the Multiple property to False after by things done, if yes, then where I could do that?

Thanks in Advance.
 
Last edited by a moderator:

Osborne

Active Member
Just tried it and found the last record is removed from the browse if the browse is not set to multiple. Just cannot explain why it is not for you.

What happens if you work backwards? GET LAST q1 instead of GET FIRST q1 and GET PREV q1 instead of GET NEXT q1.
 

reynold12

New Member
Just tried it and found the last record is removed from the browse if the browse is not set to multiple. Just cannot explain why it is not for you.

What happens if you work backwards? GET LAST q1 instead of GET FIRST q1 and GET PREV q1 instead of GET NEXT q1.
I tried this also, but this is also not working. Now in this case the First record which matches the condition is not getting deleted.
Not sure whats happening.
 
Top