web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

count with flow filed with date filter

(0) ShareShare
ReportReport
Posted on by 60

Could you please help?

I am not able to count the data with filtering date like below. its syntax error 

field(202; "Contracts expire in 45 D"; Integer)
        {
            CalcFormula = Count (ContractMasterTbl WHERE(Expiry45Date = FILTER(< Today)));
            Caption = 'Contracts expire in 45 Days';
            FieldClass = FlowField;
        }

 Reference 'Expiry45Date' in application object 'ContractMasterTbl' does not exist

but it was there in the table 

  • Lars Lohndorf-Larsen Profile Picture
    Microsoft Employee on at

    Hello,

    I tried a sample based on standard app, and this one works (or at least it compiles and runs, it is not a bit of code that could probably be used for anything:

    New flowfield on table 18:

    tableextension 50100 CustomerExtension extends Customer

    {

       fields

       {

           // Add changes to table fields here

           field(202; "Older than 45 days"; Integer)

           {

               CalcFormula = Count ("Cust. Ledger Entry" where("Posting Date" = filter(< 121221)));

               Caption = 'Older than 45 days';

               FieldClass = FlowField;

           }

       }

       var

           myInt: Integer;

    }

    Then add the field to Customer List (in helloworld.al):

    pageextension 50100 CustomerListExt extends "Customer List"

    {

       layout

       {

           addfirst(Control1)

           {

               field("Older than 45 days"; "Older than 45 days")

               {

                   ApplicationArea = all;

                   Caption = 'Older than 45';

               }

           }

       }

       trigger OnOpenPage();

       begin

           Message('App published: Hello world');

       end;

       var

    }

    That shows me 1 for all customers, and when I drill down on it, it shows the filter.

    Can you check if you can get it to work in standard app? Or, if you can provide your table if that enables repro in Cronus.

    Also check if you got symbols downloaded for table ContractMasterTbl, especially if the error you get - is that in the compiler, or at runtime you get it? If the table is part of an extension, you may need to make that extension a dependency in app.json.

    I hope this gives some ideas, let us know how you get on.

  • Suggested answer
    JAngle Profile Picture
    161 on at

    For the syntax error I would try using this method: docs.microsoft.com/.../system-calcdate-string-date-method

    The web client is able to translate 't' as text into today's date. When doing this in code you need to utilise this type of function.

  • TanmayTunveer Profile Picture
    60 on at

    Thank you for your approach. I tried with this but changed a bit like below link. it works perfectly

    community.dynamics.com/.../409892

    In my code :

    field(206; "ExpiryEndDateRange"; Date)

           {

               Caption = 'Date Filter';

               Editable = false;

               FieldClass = FlowFilter;

           }

    trigger OnOpenPage()

       begin

           SetRange(ExpiryEndDateRange, Today, CalcDate('<+45D', Today));

       end;

    field(202; "Contracts expire in 45 D"; Integer)

           {

               CalcFormula = Count (ContractMasterTbl WHERE(End_Date = field("ExpiryEndDateRange")));

               Caption = 'Contracts expire in 45 Days';

               FieldClass = FlowField;

           }

    It works.

  • TanmayTunveer Profile Picture
    60 on at

    Yes. It required. Please have a look into my reply below.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 554 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 360 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 201 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans