Multiple lookup filters with AND & OR

Hi,  

I have the following multiple filters working in a lookup:

 

"filters": [

                        function() {

                            var filterGroup = Ext.create("Terrasoft.FilterGroup");

                           

                            filterGroup.add("Segment",

                                Terrasoft.createColumnFilterWithParameter(

                                    Terrasoft.ComparisonType.EQUAL,

                                    "GlgSegment",this.get("GlgSegment").value));

                            

                            filterGroup.add("SegmentLeaderRole",

                                Terrasoft.createColumnFilterWithParameter(

                                    Terrasoft.ComparisonType.EQUAL,

                                    "Role","A25AD3ED-1095-4774-91E1-54BED571EA3B"));        

                                    

                                    

                            return filterGroup;

                        }

                    ]

 

I need to add another filter but ordering the filters in the following logical operation:

Segment AND (Role OR Role)

Looking forward to your comments. 

Regards, 

Javier

 

 

 

Like 0

Like

2 comments

Just found the solution to this problem in the following thread:

https://community.bpmonline.com/questions/lookup-field-filter

Javier Collazo,

You can also take a look at this chunk of code, it also represents the combination of two filter groups. The idea is to make firstly one filter group for OR clause. Afterwards, you create a second filter group, which combines a first one OR and other clause. By default filters are added via AND.

getCurrentUserAndTypesFilter: function() {

   var filterGroup = new this.Terrasoft.createFilterGroup();

   filterGroup.logicalOperation this.Terrasoft.LogicalOperatorType.OR;

   var innerFilterGroupCreatedBy = new this.Terrasoft.createFilterGroup();

   innerFilterGroupCreatedBy.add("CurrentUser"this.Terrasoft.createColumnFilterWithParameter(

      this.Terrasoft.ComparisonType.EQUAL"Tag.CreatedBy",this.Terrasoft.SysValue.CURRENT_USER_CONTACT.value));

   innerFilterGroupCreatedBy.add("PrivateType"this.Terrasoft.createColumnFilterWithParameter(

      this.Terrasoft.ComparisonType.EQUAL"Tag.Type", TagConstants.TagType.Private));

   var innerFilterGroupOtherTypes = new this.Terrasoft.createFilterGroup();

   var types = [TagConstants.TagType.Corporate, TagConstants.TagType.Public];

   innerFilterGroupOtherTypes.add("OtherTypes",this.Terrasoft.createColumnInFilterWithParameters(

      "Tag.Type", types));

   filterGroup.addItem(innerFilterGroupCreatedBy);

   filterGroup.addItem(innerFilterGroupOtherTypes);

   return filterGroup;

},

Regards,

Anastasia

Show all comments