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

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 

I have the same question (0)
  • Lars Lohndorf-Larsen Profile Picture
    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
    133 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

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,135

#2
YUN ZHU Profile Picture

YUN ZHU 733 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 612

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans