
Last week somebody asked me on can we extend table relation property and my answer was yes we can achieve this by table extension.
Today we will see how we can do that
Firstly create enum extension and extend as follows . For this demo I used Type field from Sales line table.
enumextension 50145 PlaySaleDocType extends "Sales Line Type"
{
value(8; Retail)
{
Caption = 'Retail';
}
}
Secondly create a table extension and modify required table relation property.
tableextension 50146 PlaySalesTabRelExt extends "Sales Line"
{
fields
{
modify("No.")
{
TableRelation = if (type = const(Retail)) Retail;
}
}
}
Hope this will help you.
Stay tuned for more update.
Good morning, I have a question: Could be ” modify(“No.”)” instead “modify(Type)”?
LikeLike
We should take field which we are modifying using extension .If No field need to modify then we can use that field.
LikeLike
Thanks for your answer, Ammolh.
Yes, but I think you must extend “No.” field Tablerelation, not “Type” Tablerelation property. Type don´t have any Tablerelation:
modify(“No.”)
{
TableRelation = if (type = const(Retail)) Retail;
}
}
LikeLike
Yes .I will update that .Thank you
LikeLike
Thank to you, great post, I didn´t know we can do that in BC.
LikeLike
Thanks for identifying that mistake. There are lot of things we can do n BC and as I finding that posting it on my blogs so it will help others.
LikeLike
Hi,
Thanks a lot.
However, if i want modify a standard table relation, can i do it ?
For exemple if i want to change the standard table relation of field [No.] Table sales line.
Add condition of item relation like this :
TableRelation = if (type = const(Item)) Item where (“MyField” = Const(true);
LikeLiked by 1 person
This is what I write
LikeLike
Ammolh, Did you really try this? In above can we do, simply table relation to one particular table irrespective of type or what I am trying to ask is changing the earlier behaviors? You have added one more type and for that you are changing tableRelation, what if for example I want to open item table for type is resource and resource table for type item. Can that be done?
LikeLike
Yes I already tried this and using in one of the app
LikeLike
This is a great post, thank you. I tried to modify Location on Purchase Lines table, and change the tablerelation to filter warehouses. But it does not take. no errors.. just doesn’t do anything.. any advise:
modify(“Location Code”)
{
TableRelation = Location where(Code = Const(‘WEST’), “Use As In-Transit” = CONST(false));
}
LikeLiked by 1 person
Same with me. I tried to modify “Sell-to Customer No.” table relation on Sales Header but there was no effect
When I select customers, all customers appear unfiltered
I modified the table relation like this :
modify(“Sell-to Customer No.”)
{
TableRelation = Customer where(“Global Dimension 1 Code” = field(“Shortcut Dimension 1 Code”));
}
LikeLike
Thanks, Amol, it really helps.
LikeLike
I am sorry but it’s not filtering in the table reationship.
LikeLike
Since we cannot change the flow field, we can add a field in the Group field it will help us to add more field detail.
The only solution, I got.
LikeLike
Let me check
LikeLike