Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

How to get Cue Values For Remaining LCY field in Customer Ledger Entry

(0) ShareShare
ReportReport
Posted on by 76

            I Created a Cue for "Sales This Year" considering Sales(LCY) field in Customer Ledger Entry. It worked well and got my Sales This Year Cue in My Business Center Role Center. In the same way, I tried to create another Cue to Show the total value of "Remaining Amt (LCY)" field in Customer Ledger Entry. If I add the field for "Remaining LCY" in Table as well as Page, I get the following error as An unexpected error occurred after a database command was cancelled.. what went wrong in my code? How to get a Cue in my role center showing Remaining Amt (LCY) in Customer Ledger Entry? I have added my code as follow: 

tableextension 50106 CueSaleNRemainingAmtTable extends "Activities Cue"
{
    fields
    {
        field(50000; CueFields; Decimal)
        {
            FieldClass = FlowField;
            CalcFormula = sum("Cust. Ledger Entry"."Sales (LCY)" where("Document Type" = filter(Invoice), "Posting Date" = filter('-1Y' .. 'CD')));
            Caption = 'Sales Amount This Year';
            AutoFormatExpression = GetAmountFormat();
            AutoFormatType = 11;
            DecimalPlaces = 0 : 0;
        }

        field(50001; RemainingLCY; Decimal)
        {
            FieldClass = FlowField;
            CalcFormula = sum("Cust. Ledger Entry"."Remaining Amt. (LCY)" where("Document Type" = filter(Invoice), "Posting Date" = filter('-1Y' .. 'CD')));
            AutoFormatExpression = GetAmountFormat();
            AutoFormatType = 11;
            DecimalPlaces = 0 : 0;
        }

    }
}
pageextension 50106 CueSaleNRemainingAmtPage extends "O365 Activities"
{
    layout
    {
        addafter("Sales This Month")
        {
            field(CueFields; Rec.CueFields)
            {
                ApplicationArea = Basic, Suite;
                Caption = 'Sales This Year';
                DrillDownPageID = "Customer Ledger Entries";
            }

        }
        addafter("Overdue Purch. Invoice Amount")
        {
            field(RemainingLCY; Rec.RemainingLCY)
            {
                ApplicationArea = Basic, Suite;
                Caption = 'Remaining Sales Amount';
                DrillDownPageID = "Customer Ledger Entries";
            }
        }
    }
}
  • Revathi.T Profile Picture
    Revathi.T 76 on at
    RE: How to get Cue Values For Remaining LCY field in Customer Ledger Entry

    Could you please elaborate to achieve the same? I tried hard with various filters with the code  CalcFormula = Sum("Detailed Cust. Ledg. Entry"."Amount (LCY)"). But i cannot able to use WHERE (Cust. Ledger Entry No.=FIELD(Entry No.),Posting Date=FIELD(Date Filter)) as filter condition.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,273 Moderator on at
    RE: How to get Cue Values For Remaining LCY field in Customer Ledger Entry

    Yes, because you are putting the custom date filter which is not applied on cust. ledger entry, just use the same datafilter with the field you are using. and see value would be matched.

    Thanks.

  • Revathi.T Profile Picture
    Revathi.T 76 on at
    RE: How to get Cue Values For Remaining LCY field in Customer Ledger Entry

    Hi,

    I have used the above code like this:

    CalcFormula = Sum("Detailed Cust. Ledg. Entry"."Amount (LCY)" WHERE("Document Type" = filter(Invoice), "Posting Date" = filter('-1Y' .. 'CD')));

    But the value i'm getting is different from the value i need. Means if I total "Remaining Amt (LCY)" field in Cust.Ledger Entry which is different from the total value of "Amount (LCY)" field in Detailed Customer Ledger Entry.

    In where condition to equate Cust. Ledger Entry No., I cannot able to find Entry No. field. 

    [quote user="Nitin Verma"]

    Hi,

    You can use as per below

    Sum("Detailed Cust. Ledg. Entry"."Amount (LCY)" WHERE (Cust. Ledger Entry No.=FIELD(Entry No.),Posting Date=FIELD(Date Filter)))

    [/quote]
  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,273 Moderator on at
    RE: How to get Cue Values For Remaining LCY field in Customer Ledger Entry

    Hi,

    You can use as per below

    Sum("Detailed Cust. Ledg. Entry"."Amount (LCY)" WHERE (Cust. Ledger Entry No.=FIELD(Entry No.),Posting Date=FIELD(Date Filter)))

  • Revathi.T Profile Picture
    Revathi.T 76 on at
    RE: How to get Cue Values For Remaining LCY field in Customer Ledger Entry

    But I cannot able to find a field for Remaining amount in Detailed Customer Ledger Entry. In Detailed Cust. Ledger Entry, we have only two fields such as Amount and Amount (LCY) fields. Which field to use to get total values of Remaining Amt (LCY) field in Customer Ledger Entry?

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,273 Moderator on at
    RE: How to get Cue Values For Remaining LCY field in Customer Ledger Entry

    Yes, because you can use Flowfield property on any Flowfield , and in your case "Cust. Ledger Entry"."Remaining Amt. (LCY)" its a flow field, instead cust. ledger entry you can use Detailed Cust. Ledger entry to get the remaining amount.

    Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,309 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans