Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Filter

Posted on by 3,027

Hi

  I am using Sale Order & Sale Line DataItem. On Request Page I have dropdown Capital & Revenue. Can i set in the property of Sale Line Dataitem to filter Items on the basis of Dropdown Value. If Capital is selected only those itens which are capital should be filtered.

Thanks

*This post is locked for comments

  • Verified answer
    Binesh Profile Picture
    Binesh 7,885 on at
    RE: Filter

    Hello,

    In Sales Line Data Item - OnPreDataItem()

    IF DropDownVariavle = DropDownVariavle::Capital THEN

    SETRANGE(SalesLine.FieldNameThatHaveCapitalValue,DropDownVariavle::Capital)

    ELSE

    SETRANGE(SalesLine.FieldNameThatHaveCapitalValue,DropDownVariavle::Revenue)

    Note: I suggest you to add one blankspace in your DropDownVariable, so if the user don't want to select any variable then it won't filtering.

  • Suggested answer
    Brad_P Profile Picture
    Brad_P 1,542 on at
    RE: Filter

    In the OnPreDataItem for the "Sales Line" you can set a filter on a field with the value from the request page SourceExpr variable.

  • jsshivalik Profile Picture
    jsshivalik 3,027 on at
    RE: Filter

    Hi

     Can't we set filter in Sales Line DataItem properties on the value input in Request Page variable

    Thanks

  • Suggested answer
    Brad_P Profile Picture
    Brad_P 1,542 on at
    RE: Filter

    Report? In the OnPreDataItem for the  "Sales Line" you can check the value that was selected on the request page and place your logic to set a filter on the sales line. If the value that you want to filter is not on the sales line then you could create a temporary sales line variable. Loop through the sales lines, do your check, if they match, add them to the temporary sales line variable. Then have an integer DataItem, in the OnPreDataItem,  set the range of the number to be 1,salesline.count (the temporary sales line) and then in the onaftergetrecord loop through the temporary sales line variable to get the records. If this is the scenario and need more assistance let me know. I didn't want to go through it all in more detail and have it be way off base.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans