Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Reg filter in the fields in form

Posted on by 560

Hi guys,

I have a form in which I created three fields namely,

Name 

checkbox

Window field

Now I have created a new text field in that form and now whenever I type starting letters it should filter that grid based on letters typed in that textbox.

Please give some suggestions.

Regards,

AXTechie

*This post is locked for comments

  • AXTechie2120 Profile Picture
    AXTechie2120 560 on at
    RE: Reg filter in the fields in form

    Thank you rustem for your valuable time

    Regards,

    AX Techie

  • Verified answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: Reg filter in the fields in form

    Try to change SysQuery::valueLike() with SysQuery::valueLikeAfter()

  • AXTechie2120 Profile Picture
    AXTechie2120 560 on at
    RE: Reg filter in the fields in form

    Sorry without pressing enter button.

    Moreover the filter searches for the letter that we  type and show all records that contains that letter but what i want is to show the record starting with that letter.

    Is there any modifications that i need  to do in that query.

    please advise.

  • Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: Reg filter in the fields in form

    What you mean by "Is there anythere way with pressing the enter button" ?

  • AXTechie2120 Profile Picture
    AXTechie2120 560 on at
    RE: Reg filter in the fields in form

    Thanks  you Rustem

    I tried it just now.

    Is there anythere way with pressing the enter button

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: Reg filter in the fields in form

    Then you need to override modified() method on your text control, call executeQuery() after super(), put text like "andrew, anderson" or "andr*, anders*" and leave field or press Enter.

    And remove textChange() method.

  • AXTechie2120 Profile Picture
    AXTechie2120 560 on at
    RE: Reg filter in the fields in form

    Hi Rustem,

    Thanks your reply,

    But my  requirement  is different.

    If i have four name like this,

    andrew, anderson etc,

    If I type a it should filter both names  and if i "andr" it should show only andrew ..

    How can i achieve this,

    Please advise.

    Regards,

    AX Techie

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: Reg filter in the fields in form

    Hi AXTechie2120!

    On your text field override textChange() method and after super() call yourTable_DS.executeQuery().

    On yourTable DS override executeQuery() method and write the following code:

    public void executeQuery()
    {
        if (yourTextField.valueStr())
            SysQuery::findOrCreateRange(this.query().dataSourceTable(tableNum(YourTable)), fieldnum(YourTable, YourField)).value(SysQuery::valueLike(yourTextField.valueStr));
        else
            this.query().dataSourceTable(tableNum(YourTable)).clearRange(fieldnum(YourTable, YourField));
    
        super();
    }


    But it's not good idea to executeQuery on every letter typing. Maybe will be enough to call executeQuery after you finish typing?

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

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