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 :
Microsoft Dynamics NAV (Archived)

How to Filter on a calculated field in the List Page

(0) ShareShare
ReportReport
Posted on by 5,136

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

I have the same question (0)
  • mmv Profile Picture
    11,471 on at

    Hi,

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

    Best Regards,

    MMV

  • Verified answer
    Daniele Rebussi Profile Picture
    2,480 on at

    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.

  • Suggested answer
    4BzSoftware Profile Picture
    6,073 on at

    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.

  • mbr Profile Picture
    5,136 on at

    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?

  • mmv Profile Picture
    11,471 on at

    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
    5,136 on at

    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.

  • Murari Jangid Profile Picture
    85 on at

    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

  • Murari Jangid Profile Picture
    85 on at

    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 :)

  • Suggested answer
    mbr Profile Picture
    5,136 on at

    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

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 > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans