Hi guys, I started programming navision a week ago, but I ran into a problem that I can't solve. On the sales line, I want to put a field for the article in which the article table has the necessary content.
I have used the FlowFields Lookup function, but with that the field does not appear in the configuration packages. What could be an alternative? Alternatively, is this function the only one that can transfer field data from another table and load it in one by one?
Thanks in advance.
I hope I didn't ask stupid questions.
Hi
Not sure it will work, I am confused with your requirement.
[EventSubscriber(ObjectType::Table, Database::"Sales Line", 'OnAfterValidateEvent', 'No.', true, true)] local procedure OnAfterValidateEvent_itemNo(var Rec: Record "Sales Line") var Item: Record Item; ItemUnitofMeasure: Record "Item Unit of Measure"; begin if rec.Type = rec.Type::Item then if Item.get(rec."No.") then begin rec.Newfield := Item.Desirecfieldvalue; if ItemUnitofMeasure.Get(rec."No.", rec."Unit of Measure Code") then rec.Quantity := ItemUnitofMeasure."Qty. per Unit of Measure"; end; end;
I want it in sales line. But the real problem is, How can I specify 2 conditions for a request?
Because I would need the Item Unit of Measure table to give me the value where the id and Code fields match the condition.
Where you want this change?
i want this: WHERE("Item No." = FIELD("No."), Code = Field("Myfield what fill with data before with your code")));
How can i do this with trigger?
I hope, u know what i want.
If not, write me what i should give.
So what is the Sales Line field and item table field in that?
Yeah but the calc is not good for me, i want to change it like this:
[EventSubscriber(ObjectType::Table, Database::"Sales Line", 'OnAfterValidateEvent', 'No.', true, true)]
local procedure OnAfterValidateEvent_itemNo(var Rec: Record "Sales Line")
var
Item: Record Item;
begin
if rec.Type = rec.Type::Item then
if Item.get(rec."No.") then
rec.Newfield := Item.Desirecfieldvalue;
end;
There is already a where condition in your formula
Hello thanks a lot, its work fine for me, i wasnt to far from that. :)
But now i have the next problem, how can i put "where". If I have 2 condition?
I hope u know what i want.
CalcFormula = lookup("Item Unit of Measure"."Qty. per Unit of Measure" WHERE("Item No." = FIELD("No."), Code = Field("Tour unit help")));
It was my calc formula code.
Hi,
Flowfields never visibles on Config. package. In that case you need to change your logic. Create a new field on Sales Line Table, and OnAfterValidate event of sales line with No. field pass the values from the Articale table to your new table. and then you can use your config. package.
[EventSubscriber(ObjectType::Table, Database::"Sales Line", 'OnAfterValidateEvent', 'No.', true, true)] local procedure OnAfterValidateEvent_itemNo(var Rec: Record "Sales Line") var Item: Record Item; begin if rec.Type = rec.Type::Item then if Item.get(rec."No.") then rec.Newfield := Item.Desirecfieldvalue; end;
Hi,
If I understand you correctly, you can do this by simply adding a table relation to your sales line field, like this
tableextension 50100 MyExtension extends "Sales Line" { fields { field(70000; YourField; Code) { TableRelation = Item."No."; } } }
This should establish the relation, lookup, and allow data transfer.
Regards
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