Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

How to Filter on a calculated field in the List Page

(0) ShareShare
ReportReport
Posted on by 5,126

I have a Page with repeater as control.  That repeater control will have a column that is actually a calculated field or a function that returns a value.  Users ant to be able to filter this value. The problem is the 'filter on this value' is disabled when it's not an actual column field.  How can I mimic this behavior?  E.g., I want to filter on the calculated field.  Please help.

*This post is locked for comments

  • Suggested answer
    mbr Profile Picture
    mbr 5,126 on at
    RE: How to Filter on a calculated field in the List Page

    Hello Murari,

    You cannot filter on calculated or table functions.  The only way is to use the MARK functions.  please read my previous response as I have pasted my sample code.

    mbr

  • Murari Jangid Profile Picture
    Murari Jangid 81 on at
    RE: How to Filter on a calculated field in the List Page

    Hello mbr,

    Even i am trying to find the solution of same problem. But its not possible actually.

    If you have found any solution regarding same then please let me know.

    Thanks in advance :)

  • Murari Jangid Profile Picture
    Murari Jangid 81 on at
    RE: How to Filter on a calculated field in the List Page

    Hello Daniele Rebussi, 

    I just read your comment on asked question but i am not able to understand. What you want to say exactly. How mark and Markedonly will work in this case

  • mbr Profile Picture
    mbr 5,126 on at
    RE: How to Filter on a calculated field in the List Page

    hi MMV, I have created a temp table and set its property as temporary in the globals.  Then I run the function once that populates the item and the calc field in that temp table.  So whenever they perform filters on the calc field via Page action, I go through that temp table to check if condition for each item is met, if so, mark it.  And this is fast!  The only downside is initially when it runs to populate, it takes a little time.  So all is well now.  I may look into another strategy as I don't like the performance degradation when populating the temp table initially.   But to answer your question, no, the source table is different from my temp table.

  • mmv Profile Picture
    mmv 11,467 on at
    RE: How to Filter on a calculated field in the List Page

    Hi mbr,

    Is it the same table you are using as the source of the page where you have written the above code?

    Best Regards,

    MMV

  • mbr Profile Picture
    mbr 5,126 on at
    RE: How to Filter on a calculated field in the List Page

    Hi Daniele.  Yeah. I think using Mark/MarkedONly is the only way.  I finally got it to work whereby I created Page Actions with the logic and logic values for users to select.  Then to actually filter, I am evaluating these logic (<,>,=, <>) selected plus the values (0-9) to perform the test against a calculated fields and then mark records as true.  The problem is it's very slow because everytime, I always have to recalculate the field in question as I am unable to read from REC since they are not actual fields.  So now I am thinking of storing these calc fields plus the corresponding Item (for primary key) Number in a temporary table which I can declare in the Globals.  For some reason, I am UNABLE to insert into this temporary table.  It keeps giving me an error: A transaction must be started before changes can be made to the database.  My code simply populates the temporary table below at the end of the aftergetrecord event whereby MonthsOnHand field is calculated.

    TmpItem.INIT;

    NextRowNo := NextRowNo + 1;

    TmpItem.EntryNo := NextRowNo;

    TmpItem.ItemNo := "No.";

    TmpItem.MosOnHand := MonthsOnHand;

    TmpItem.INSERT();

    What am I missing?

  • Suggested answer
    4BzSoftware Profile Picture
    4BzSoftware 6,071 on at
    RE: How to Filter on a calculated field in the List Page

    Hi Mbr,

    We can filter on FlowField. Can you change it to FlowField?

    Otherwise, you have to save information in normal field because we cannot filter on variable or function columns.

  • Verified answer
    Daniele Rebussi Profile Picture
    Daniele Rebussi 2,480 on at
    RE: How to Filter on a calculated field in the List Page

    You need to handle the filter capability via code, with an object (e.g. a report request page) to allow user typing the filter and using MARK/MARKEDONLY functions to restrict the number of records shown.

  • mmv Profile Picture
    mmv 11,467 on at
    RE: How to Filter on a calculated field in the List Page

    Hi,

    Unless, it's a table field, I don't think it's possible.

    Best Regards,

    MMV

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans