Forum Discussion

joaobc's avatar
joaobc
Occasional Contributor
5 years ago

How to filter a grid using native features of delphi

In a grid of a delphi application, it is possible to make this filter in the table via script command in the test complete?

 

 

Investigating in the object browser of that grid, I found the command that does the filtering at that address

(...).DataController.Filter.FilterText, contained this: "(DESCRIPT LIKE 'Óleo%') AND (VALUE = 3,2248)"

 

However if I change the data in the DESCRIPT or VALUE field and execute it it seems that it has no effect.

 

In several doubts I solved consulting the topics of the documentation(https://support.smartbear.com/testcomplete/docs/app-objects/specific-tasks/grids/devexpress-quantum/index.html), but in this specific case I couldn't find anything that would help me

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    I am not sure where and how you have tried to change filter data, but it is my understanding that .FilterText property is just a textual representation of the applied filter.

    Highlight the required grid object in your tested application using Object Spy and check the Methods pane in the Object Browser / Object Spy. This pane will list all methods that are accessible from test script code.

    Talk to your developers and ask them how they are setting filter in code. Check if the same method is accessible to you in TestComplete. Depending on the implementation of the grid, you might be needing debug version of it (along with debug information) to be used in the tested application in order to access required method.

     

    • joaobc's avatar
      joaobc
      Occasional Contributor

      Really .FilterText property is just a textual representation of the applied filter, but it was my attempt. I do not master the Delphi language, my scripts in Test Complete I develop in javascript.

       

      I am using it in active debug mode. The developer compiled following the example of the test complete documentation.


      Yesterday I talked to a colleague at work who had the source code, we found that the grid filter uses an object with class TVsClientDataSet. Even the IndexFieldNames property has the name of the columns.

       

      I ended up solving the window I sent in the print, checking the column with the value (3,2248 and 2,66). And I continued my script development

       

      As soon as I encounter similar problems I will investigate in the class (TVsClientDataSet) and post here if I discover something

       

      There is a way to search the object browser for words? For example, I've been trying to use the Find() and FindChild() methods, but in the Property parameter (PropNames) I can't use regular expressions, only in PropValues. The idea is to search for the words that were in the grid columns.

       

      Regards,

      João

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thank you for reply Alex!

       

      joaobc Does this help? Please share your progress with the Community regarding this issue🙂