Question: tablebox + drill-down

ResenderResender Member Posts: 119
edited 2012-03-19 in Navision Attain
Hello all,
I got the current situation
A form displaying a list of adress's in a tablebox, these adress's have to be viewed by the user to see if their the correct ones.The are importadress's and each is linked to a areacode.

*A field & variable #... is added to the tablebox, it has to show how many alternative adress's are available for this current one.

*On the #..., we want a drill down to lead us to a form that shows all the alternate ones.

I added the variable and the field,added dril down to the field. Created the new form,ect...

Now comes the problem, the #... shows the total amount of adress's that are around and not the amount available for the area code.
Second problem is the drill down instead of passing the records for the area code it passes them all along.

Anyone know how this must be done.

Answers

  • ResenderResender Member Posts: 119
    Resender wrote:
    Hello all,
    Second problem is the drill down instead of passing the records for the area code it passes them all along.
    OK, since noone answers and probably me just asking questions wrong, I started looking through the dozens upon dozens of existing forms looking for drill down and table boxes.

    And after a day or 2 I found a drill down that didn't involve table relationships
    (Simplified and changed names)
    MyRecVar.RESET;
    MyRecVar.SETRANGE(Key1,recFrm.Key1);
    
    CLEAR(MyFrmVar);
    MyFrmVar.SETTABLEVIEW(MyRecVar);
    MyFrmVar.RUNMODAL;
    

    Off course that didn't do the trick 100%
    So I focused my search from combining the 2 questions to 1.
    'In Navision Attain 3.60, how do I get the data from the current selected record(s) in a tablebox ?'

    I found the following
    CurrForm.SETSELECTIONFILTER(MyRecVar);
    

    Ok, so now I can pass the current selected record(s) along, problem now is that I don't need
    that record that I selected, I need all the alternatives for that record.
    However when I do a message post directly after the setselectionfilter I get an empty message.
    So the second problem is solved, now back to the first, find the amount of alternatives for each record.
    Ok I resolved this on my own as well
    MyRecVar.RESET;
    MyRecVar.COPYFILTERS(Rec);
    MyRecVar.SETRANGE(Adrescode,Rec.Adrescode);
    MyRecVar.SETFILTER("Primary key",'<>%1',Rec."Primary key");
    
    MyFrmVar.SETTABLEVIEW(MyRecVar);
    MyFrmVar.RUNMODAL();
    
    This allows le to show all the alternatives for an adress excluding the one already selected.

    And a thirth problem occured but that I can resolve with the guy who made the existing code.

    I also resolved the first problem I had
    Resender wrote:
    Now comes the problem, the #... shows the total amount of adress's that are around and not the amount available for the area code.

    Solved this as well, by looking to the individual problem and not to the whole
    First I found an excellent post here on Mibuso about the Difference Between OnAfterGetRecord & OnAfterGetCurrRecord

    So I did the following in the OnAfterGetRecord of my form
    iAantal := 0;
    
    lrecConv.RESET;
    localRecVar.COPYFILTERS(Rec);
    localRecVarSETRANGE(Adrescode,Rec.Adrescode);
    IF localRecVar.FIND('-') THEN BEGIN
      REPEAT
        iAantal := iAantal +1;
      UNTIL localRecVar.NEXT = 0;
    END;
    

    I then ran this and looked if into the table if this was indeed showing the correct number for each adrescode.

    Ok, so how come I have now found everything on my own, well:
    1)I had a weekend with no worries so fresh prospective
    2)Found code simelar to what I was needing in existing form
    3)I looked to the individula parts instead of the whole
Sign In or Register to comment.