CTRL+HOME on subform with Temporary Table

TMATMA Member Posts: 2
Hi,

I have a form with subform. The subform contains a tablebox. The fields in this tablebox have as source expressions variables from a temporary table "GrecTempTableXXX". The source table of the subform is "table XXX" (not temporary of course).
After filling up the temp table following code is added for the subform to be able to show the info from the temp table in the form:

Trigger: OnFindRecord(Which : Text[260]) : Boolean
Code: EXIT(GrecTempTableXXX.FIND(Which));

Trigger: OnNextRecord(Steps : Integer) : Integer
Code: EXIT(GrecTempTableXXX.NEXT(Steps));

This works all fine, but when you run the form (and you have 5 records for example), and then press CTRL+HOME, the form will show 4 focusable records under your first record, but also 4 non-focusable records above your first record (copies of the last 4 records). How can I make these 4 non-focusable records that are not in place there disappear??? The function CTRL+HOME still has to bring me to the first record.

Comments

  • kinekine Member Posts: 12,562
    It seems that you are using the temp table on the form in non-standard way. Standard code for doing that is like this:


    Form - OnFindRecord(Which : Text[1024]) : Boolean
    GrecTempTableXXX := Rec;
    IF NOT GrecTempTableXXX.FIND(Which) THEN
      EXIT(FALSE);
    Rec := GrecTempTableXXX;
    EXIT(TRUE);
    
    
    Form - OnNextRecord(Steps : Integer) : Integer
    GrecTempTableXXX := Rec;
    CurrentSteps := GrecTempTableXXX.NEXT(Steps);
    IF CurrentSteps <> 0 THEN
      Rec := GrecTempTableXXX;
    EXIT(CurrentSteps);
    

    On the table box you are than using the fields from REC (as if the table is not temporary). All this leads to correct listing and usage of the temporary table. If you can apply user filters, than you need just add copying the actual filters from REC to the Temp variable before each block of code to have each time same filters on REC and on the Temp...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.