Hello everyone,
i'm struggeling to create a relationship in AL. Maybe someone can help with this or point me in the right direction.
I create a table (A). This table (A) should a have one to one relationship to another table (B). The other table (B) has a composite key based on 5 fields (Fields: V,W,X,Y,Z).
What steps a necessary to create this relationship?
Only one TableRelation on the first field seems not to work and i don't know how to setup the relation with all the other fields.
In the end, i want to select only one field on the page and i want to make sure, that it is the correct relationship.
I hope someone has an idea.
Greetings,
Ben
Looks ok, great.
Hey Zhu,
i found a fitting solution with your link under point "2. Using OnLookup (Field) Trigger and Page.RunModal() Method".
The solution looks like this.
field(2; V; Code[20]) { Caption = 'V'; trigger OnLookup() var "Table B-Record": Record "Table B"; begin "Table B-Record".Reset(); if Page.RunModal(Page::"Table B List Page", "Table B-Record") = Action::LookupOK then begin V := "Table B-Record".V; W := "Table B-Record".W; X := "Table B-Record".X; Y := "Table B-Record".Y; Z := "Table B-Record".Z; end; end; }
Can you confirm that this solution is viable?
Btw. you can ignore my other post.
Greetings,
Ben
Hello Zhu,
thank you for your response.
I just looked at it and i'm not sure if this solution fits for my case.
Unfortunately it is not only about displaying a field accordingly, but to store the key (W,V,X,Y,Z) in table (A), so that I can later find the correct entry in table (B) in a code unit and use the fields of table (B) in my code.
Maybe i misunderstood your solution, could you please explain how to apply your solution to my case?
Greetings,
Ben
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,151 Super User 2024 Season 2
Martin Dráb 229,993 Most Valuable Professional
nmaenpaa 101,156