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 AX (Archived)

Filter Multiple Grid Columns Using StringEdit Control

(0) ShareShare
ReportReport
Posted on by

Hi all , 

Please let me know how to filter multiple grid columns using a single stringEdit control .

I mean when we enter any text into the field then it should get compared with all the grid columns and if exists should get filtered accordingly .

Please provide me samples

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    reachnaidu Profile Picture
    890 on at

    Hi,

               There is no direct way to do this. Since you want to Query all the fields from the grid , We need to add ranges to the datasource that is pointing to the Grid. In the modified field method of string control, call datasource.ExecuteQuery() function

    where we need to add ranges to all the fields of the Grid by using the wild card to make sure that Text appears in any of the fields

    For ex:

      qbds  = query.addDataSource(tableNum(Inventtable));

       qbr = qbds.addRange(fieldNum(Inventtable,ItemID));

       qbr.value(strFmt('*%1*',TextFieldValue);

       qr = new QueryRun(query);

    Similarly you need to add the same for rest of the fields .. Hope this helps. If you really need a sample i could send you later.

    Mean while look in SalesQuotation form where we can filter the Quotations based on Employee Id and look the executeQuery method of SalesQuotationTable datasource.

    Thanks

  • Community Member Profile Picture
    on at

    Thanks a lot for your Sree.  I am having glance at SalesQuotation Form and Table.

    Please if you find time , Send me a sample. It would be a great help to me . Please

  • Community Member Profile Picture
    on at

    Hi Sree ,

    Can you please let me know , how to filter a grid field if it is holding numbers as its contents.  

    And also please send the sample

  • Hariharans87 Profile Picture
    3 on at

    Refer into this link for filtering records dynamicsaxhari.blogspot.in/.../filtering-records_15.html

  • Community Member Profile Picture
    on at

    Hi Hariharan ,

    Thanks a lot. I have already done the filtering.

    Only thing with which I am getting stucked is that in my grid there is a field called PRICE which holds only numerical values and am not able to filter using that field alone.

    Rest for two other fields it is getting filtered  .  And am using a string edit control to filter records.

    Please let me know why it is not getting filtered when am using the third field

    Thanks :)

  • Hariharans87 Profile Picture
    3 on at

    It should work. There may be a problem in your code. Share your code.

  • Community Member Profile Picture
    on at

    public void executeQuery()

    {

       str s;

        //  queryBuildRange = QueryBuildDataSource.addRange(fieldNum(PurchTable,DeliveryName));

       //fieldNum(PurchTable,URL));

       F_queryBuildRange.value(strFmt('((%1 LIKE "%2")) || (%3 LIKE "%2")) || (%4 LIKE "%2"))',

                          fieldStr(MFilter, CustName),

                         "*"+ txtFilter.valueStr()+"*",

                          fieldStr(MFilter,ItemName),"*"+ txtFilter.valueStr()+"*",

                          fieldStr(MFilter,Price), System.String::Format("{#:##.####}", sysDouble)));

                         // fieldStr(MFilter,Price),"*"+ txtFilter.valueStr()+"*"));

       super();

    }

  • Community Member Profile Picture
    on at

    I am getting this error message

    "Null could not be obtained."

  • Hariharans87 Profile Picture
    3 on at

    There is a problem I found in the strFmt parameters. You are referring the wrong parameters. I have changed the parameter orders. Try with my updated code and let me know.

    F_queryBuildRange.value(strFmt('((%1 LIKE "%2")) || (%3 LIKE "%2")) || (%4 LIKE "%5"))',
    	fieldStr(MFilter, CustName),
    	"*"+ txtFilter.valueStr()+"*",
    	fieldStr(MFilter,ItemName),
    	fieldStr(MFilter,Price), 
    	System.String::Format("{#:##.####}", sysDouble)
    ));


  • Community Member Profile Picture
    on at

    still am getting the same Error ( NULL Could not be Obtained ) .

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 AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans