Hi BC Community,
How can I get from Approval Entry Table (454). Its PK is an entry No. which is not referenced (I think) anywhere else. So when I get....I can not find any records.
Any advice would be appreciated, my sample code is below:
trigger OnAfterGetRecord() begin if purchaseHeader.Get("Purchase Line"."Document Type", "Purchase Line"."Document No.") and (Type = Type::Item) then begin approvalEntry.SetFilter("Document No.", purchaseHeader."No."); if approvalEntry.get(approvalEntry."Entry No.") then if purchaseInvoiceHeader.Get(purchaseHeader."Last Posting No.") then if purchaseInvoiceLine.Get(purchaseInvoiceHeader."No.") then begin purchaseInvoiceLine.Reset(); purchaseInvoiceLine.SetRange(purchaseInvoiceLine."Document No."); if purchaseInvoiceLine.FindSet() then begin end; end; end end;
Get only works with Primary key and does not findfirst along,
we have FINDFIRST, FINDSET, FINDLAST.
You can follow the below link to understand them better
That's cool, I will try that.
Can I ask, am I able to use GET / FINDFIRST to get records from a table? I am only used to using GET.....i guess there are other methods?
Hi,
Your declaration of set filters are wrong please try below
trigger OnAfterGetRecord() begin if purchaseHeader.Get("Purchase Line"."Document Type", "Purchase Line"."Document No.") and (Type = Type::Item) then begin approvalEntry.SetFilter("Document No.", purchaseHeader."No."); if approvalEntry.findfirst then if purchaseInvoiceHeader.Get(purchaseHeader."Last Posting No.") then if purchaseInvoiceLine.Get(purchaseInvoiceHeader."No.") then begin purchaseInvoiceLine.Reset(); purchaseInvoiceLine.SetRange(purchaseInvoiceLine."Document No."); if purchaseInvoiceLine.FindSet() then begin end; end; end end;
Hi Nitin,
Hi,
I am not clear with your requirement what you are trying to achieve, can you please brief it more?
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