web
You’re offline. This is a read only version of the page.
close
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";
            }
        }
    }
}
I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,708 Moderator on at

    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.

  • Revathi.T Profile Picture
    76 on at

    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
    21,708 Moderator on at

    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
    76 on at

    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
    21,708 Moderator on at

    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
    76 on at

    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,362

#2
YUN ZHU Profile Picture

YUN ZHU 867 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 607

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans