Skip to Content
author's profile photo Former Member
Former Member

filter_by_property not working for filtering contents : Kindly Suggest

Hi Experts,

I need to put a default filter for values present in a table (Only for first time it is loaded ). For this I tried using filter_by_property method in WD_Create_Context , but it is unable to filter the contents. While debugging I find out that the the method is filtering the records but filtered records are not reflected in the table. It is displaying full set of data. The code I used is this

lr_itr_roles->filter_by_property( iv_attr_name = 'ID' iv_value = 'ABC' ).

Kindly Help.

Regards,

Nitesh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 15, 2012 at 09:32 AM

    Hi Nitesh,

    When you set filter through iterator, it doenot actually filters records at collection level. Iterator is just a pointer instance for collection, when you set filter for some attribute, iterator points to only records that meet filter criteria. when you start reading data through iterator, get_first, get_next methods in a loop(while, end while), they will return instances that meet filter criteria.

    So to achive your functionality, you may have to read all the instances that meet the filter(in the above said manner) and add to a new collection and set the collection to your context.

    Hope this clarifies the difference between collection and iterator.

    Regards,

    Priyanka

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Priyanka,

      The Issue has been resolved. Thanks a lot for your detailed inputs.

      Actually this is a standard object and custom controller context node is binded with the view context node, thats why all the changes in data were reflected in both.

      I tried another way that is by creating a global attribute in implementation class and stored the collection in it.

      After that I filtered the data in initial run and displayed it, Then in next run, I fetched the data from global attribute holding the data and transfered it to collection wrapper again.

      So initially the filtered records are dispalyed and on subsequest runs the original data is displayed.

      Thanks once again.

      Regards,

      Nitesh

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.