Filtering
Custom Details
Filters

Hi all,

i want to ask on how to filter the filtration field.

i want this field shows only some data, not all.

how to do it?

 

thanks all..

 

Like 0

Like

1 comments

Hello Jordy,

You can do that in the following way:

1) Open the replacing object that is usually in the Custom package (in the configuration).

2) Open all settings of the object: http://prntscr.com/ioprlo

3) Then you can set the usage mode for the column as "None".

Please note that if you set such usage mode for the column, you won't be able to filter the records by it but also you won't be able to add this field to be displayed in the tile or list view in the section.

Best regards,

Oscar

Show all comments
Filtering
Filters
list
section list

Hi,

Is there a way to filter a section list for it to show only the first 10 records?

 

Regards.

Like 0

Like

1 comments

Hello Javier,

Currently there is no possibility to do that with the help of standard filtration tool. I will create a request to our R&D team so they could add this functionality to the OOB version. Thank you for this suggestion!

Also please note that you can use sorting tool in a section that also allows to show first 10 records based on sorting direction. Also you can use tags so to mark 10 records that can be found in future if needed.

Also you can add a field on the page (integer type) that can be auto incremented upon records adding. You will also need to add a system setting that stores current number of this field. At the very beginning it will be 0. After that you need to create a business process that will update the value of added on the page field for the new record with the value of that system setting and after that increase the value of system setting to n+1 where n - is a current value.

Best regards,

Oscar

Show all comments
Filtering
Filters
look up filters
lookup
studio

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
Discussion
studio
rules
Filters

Currently, there is no way to filter text fields for partial values in Business Rules.  For example, I want to be able to filter the names of roles for Quality Engineer out of a variety of different roles, e.g., Product Quality Engineer, Factory Quality Engineer, etc.  Please implement a LIKE function in or separate from equal and not equal.

1 comments

Dear Janine, 

Thank you for the suggestion. We've registered such request to the RnD team. 

Best regards, 

Dennis

Show all comments

Hi everybody.

We need to create filters to display only accounts owned by the current user. The goal is to create just a unique filter (i.e. My Accounts) that compares the Account Owner with the Logged in User. So the same filter will show different accounts depending on the active user. Thanks for your comments.  Diego

Like 0

Like

2 comments

I want to filter a lookup based on contact to show only a role: 

 

Like 0

Like

5 comments

Dear Daniel,

You can add a role column to the contact section view and use main section filter to look for the contacts with the required role http://prntscr.com/n664lp

If you are talking about the system users and organizational roles, you will have to build the extended filter. Here is the example -http://prntscr.com/n6657b

Best regards,

Dean

Dean Parrett,

Hello dean, 

Thanks for the answer. 

This is a section other than contacts. 

I need to choose 1 contact to filter it by and show only this contact's information. 

The issue is that the filter shows all contacts and not only employees. 

What I need is a filter on the lookup so that when I am looking for an employee named "erik" I do not have to see other 20 clients named "erik" 

 

Dear Daniel,

Since you need to filter contacts, the section is still based on contact object. You will still have to build the advanced filter to filter. It is better to create a separate folder for employees and set up this filter http://prntscr.com/n6p5rx Thus you will be able to look for the employee easily. Here is the example of whole section view http://prntscr.com/n6p7ut and using the filter https://prnt.sc/n6p7xs 

One more solution is to use quick filter by account 'Our Company'. This is system account used of employees only. http://prntscr.com/n6p85i

It would not be possible to show only employee when filtering all contacts only by identical names since the search indexes all records by the name column in the database table. Your section would need to have only employees and no clients. 

Also there is the out-of-the-box section 'Employees'. You can use it to find the employees faster http://prntscr.com/n6p9m0

Best regards,

Dean

I think i didn't explain myself. 

I do not need to filter the role. I need to fitler by an especific person.

On the orders section (Or any order) I want to se all order owned by "Erik" 

But on the main filters if i write: "Erik" The list of contacts with that name is huge. So to find the 1 employee that works with us its a bit of a hassle. 

Dear Daniel,

Please accept my apologies for the late reply. 

It would not be possible to show the 1 contact with the name Erik since the system looks for all records with the contact name Erik and will show you all the results. You would need to add some other condition to the filter, that would be unique for this contact. It is better to use at least the full name filter (with the last name) that would help you to close the search results in.

Best regards,

Dean 

Show all comments
Filtering
Filters
lookup
7.11

It give me this error : 

 Cannot read property 'High' of undefined 

when I write this code:

filters.add("ActvityStatus", this.Terrasoft.createColumnFilterWithParameter(

                            this.Terrasoft.ComparisonType.EQUAL, "Status",ConfigurationConstants.Activity.Status.High));

 

why can't access the value 'High' of the lookup 'Status' of the activity object

Like 0

Like

6 comments

Dear Mohamad,

Please follow the steps given by Grigory. The issue is most likely related to not indicated activity status in Configuration Constants.

The other reason could be not indicated ConfigurationConstants as a dependency in the schema. Please check, that you have added it to dependencies:

Regards,

Anastasia

I  have added it to dependenices

Mohamad, 

In this case please double-check that you have added "High" activity status to the Configuration Constants.

Regards,

Anastasia

 

 

Anastasia Botezat,

how to do that?

Dear Mohamad,

In order to set needed status you can go two ways:

1. Hard code the Id of needed status. In this case filtration will look like this, where zeros are status Id:

filters.add("ActvityStatus", this.Terrasoft.createColumnFilterWithParameter(
   this.Terrasoft.ComparisonType.EQUAL, "Status", "00000000-0000-0000-0000-00000000"));

2. Go to the system configuration, create a replacing module of ConfigurationConstants schema. Copy all the code from parent ConfigurationConstants schema. Finally, add the activity status to the activity status block in the schema.

Regards,

Anastasia

Anastasia Botezat,

Thank you

Show all comments
Filters
Filtering
Sections
section

I need to filter grid section list of any page (for example the account section) but  by code

any help?

Like 0

Like

4 comments

Hi!

It depends on what exactly you want to implement. If you want to filter records in the section in order to display only certain records you can easily check how records are filtered in ActivitySectionV2:

Image.png



In case you want to filter values in the field you can either filter them according to any other field or just configure access rights for lookup object accordingly. Can you please provide more detailed example of what you are trying to implement? 

Angela Reyes,

Yes I want to filter records in the section in order to display only certain records  , I tried to do that but I failed, can you please add a code

I want to add a checkbox in the actvity section page near to date filter when check the box filter the section grid , can you please add code?

The image you sent does not open

mohamad abdallah,

Code is: 

                    filters.add("NotEmailFilter", this.Terrasoft.createColumnFilterWithParameter(

                        this.Terrasoft.ComparisonType.NOT_EQUAL, "Type", ConfigurationConstants.Activity.Type.Email

                    ));

 

Please specify how exactly this checkbox must work? What it must hide? 

Show all comments
7.11
studio
ESQ
Filtering
Filters
Activities

I really need to solve this question , even a part of them

-Create new filter “Attention” in the Activity section grid page (near Owner and Date filters). When turned on, only overdue activities and high priority 

 today activities should be displayed. Filter should use current user time zone.

 (using code and not filter manually)

Like 0

Like

2 comments

In ActivitySectionV2 do it by analogy with this example

1) Create new filter near Owner and Date filters

{

    "operation": "insert",

    "parentName": "IsActiveFiltersContainer",

    "propertyName": "items",

    "name": "IsActiveCheckbox",

    "values": {

        "bindTo": "IsActive",

        "caption": "Активные",

        "controlConfig": {

            "className": "Terrasoft.CheckBoxEdit",

            "checkedchanged": {

                "bindTo": "onIsActiveCheckboxChecked"

            }

        }

    }

}

2)

getFilters: function () {

    var sectionFilters = this.callParent(arguments);

    this.setIsActiveFilter(sectionFilters);

    //this.setCommunicationFilter(sectionFilters);

    return sectionFilters;

},

setIsActiveFilter: function (filterCollection) {

    var isActive = this.get("IsActive");

    if (isActive) {

        if (!filterCollection.contains("IsActiveFilter")) {

            filterCollection.add("IsActiveFilter", this.Terrasoft.createColumnIsNullFilter("Account"));

        }

    } else {

        filterCollection.removeByKey("IsActiveFilter");

    }

},  

onIsActiveCheckboxChecked: function (value) {

                if (!this.get("IsSectionVisible")) {

                    return;

                }

                this.set("IsActive", value);

                this.sandbox.publish("FiltersChanged", null, [this.sandbox.id]);

                this.reloadGridData();

            },       

3)Add atribute "IsActive"

attributes: {

      "IsActive": {

          "dataValueType": this.Terrasoft.DataValueType.BOOLEAN,

          "type": this.Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,

           "value": true

            },

        }

}

Hello!

Please see a comment from Grigoriy above, this would help you implement your idea.

Matt

Show all comments
Filters
detail
7.12
sales

Hello all,

I am trying to save detail filters after crossing between sections. For example

I have set the details filters => the records have been filteres.  After that I entered into the other section and returned back. There aren't any filters.

What I have done:

For example, if we will do such actions on section,everything will be ok and filters will be saved. So I have write setFilters and saveFilters methods. I built upon these methods from section. In SysProfileData I have saved the KEY = AccountPageV2Schema11DetailFilters ( getFiltersKey method)

getFiltersKey: function() {

                    var cardName = this.values.CardPageName;

                    var schemaName = this.name;

                    return cardName + schemaName + "Filters";

}

But unfortunately, it doesn't work. How can I solve this problem ? Maybe I build incorrect template([PageName][SchemaDetail]Filters)? Thanks a lot!

Full code:


define("BaseGridDetailV2", ["BaseGridDetailV2Resources", "ConfigurationEnums", "RightUtilities",
    "ProcessModuleUtilities", "GridUtilitiesV2", "WizardUtilities", "QuickFilterModuleV2", "ProcessEntryPointUtilities"
], function(resources, enums, RightUtilities) {
    return {
        messages: {},
        mixins: {},
        attributes: {
            // "ProfileFilters": {
            //         dataValueType: Terrasoft.DataValueType.CUSTOM_OBJECT
            //     }
        },
        methods: {
            // filterCurrentSection: function(args) {
            //         if (args.schemaName !== "" && args.schemaName !== this.entitySchema.name) {
            //             return false;
            //         }
            //         var column = {
            //             value: this.entitySchema.primaryDisplayColumn.name,
            //             displayValue: this.entitySchema.primaryDisplayColumn.caption,
            //             dataValueType: this.entitySchema.primaryDisplayColumn.dataValueType
            //         };
            //         var filters = [{
            //             value: args.value,
            //             column: column
            //         }];
            //         var quickFilterModuleId = this.getQuickFilterModuleId();
            //         this.sandbox.publish("SetCustomFilters", filters, [quickFilterModuleId]);
            //         return true;
            //     },
            subscribeSandboxEvents: function() {
                this.callParent(arguments);
                var editPages = this.getEditPages();
                editPages.each(function(editPage) {
                    var typeColumnValue = editPage.get("Tag");
                    var cardModuleId = this.getEditPageSandboxId(editPage);
                    this.sandbox.subscribe("getCardInfo", function() {
                        var detailInfo = this.getDetailInfo();
                        var cardInfo = {
                            valuePairs: detailInfo.defaultValues || []
                        };
                        var typeColumnName = this.get("TypeColumnName");
                        if (typeColumnName && typeColumnValue) {
                            cardInfo.typeColumnName = typeColumnName;
                            cardInfo.typeUId = typeColumnValue;
                        }
                        return cardInfo;
                    }, this, [cardModuleId]);
                }, this);
                this.sandbox.subscribe("CardSaved", this.onCardSaved, this, [this.sandbox.id]);
                //
                // this.initGetFiltersMessage();
                // var quickFilterModuleId = this.getQuickFilterModuleId();
                // this.sandbox.subscribe("CustomFilterExtendedMode", this.showCustomFilterExtendedMode, this,
                //         [quickFilterModuleId, folderManagerModuleId]);
                //
                this.subscribeGetModuleSchema();
                this.subscribeFiltersChanged();
                this.subscribeGetShortFilterFieldsVisible();
                this.sandbox.subscribe("GetRecordInfo", this.getRecordInfo, this,
                    [this.getRecordRightsSetupModuleId()]);
                this.sandbox.subscribe("GetExtendedFilterConfig", this.getExtendedFilterConfig, this,
                    [this.getQuickFilterModuleId()]);
            },

            init: function(callback, scope) {
                this.callParent([function() {
                    this.mixins.WizardUtilities.canUseWizard(function(result) {
                        this.set("IsDetailWizardAvailable", result);
                        callback.call(scope);
                    }, this);
                }, this]);
                this.registerMessages();
                this.initDetailFilterCollection(); // return this.set("DetailFilters", this.Ext.create("Terrasoft.FilterGroup"));
                this.initFilterVisibility();
                this.isFilterAdded();
                var sandboxId = this.getQuickFilterModuleId();
                this.sandbox.subscribe("InitFilterFromStorage", function() {
                    this.sandbox.publish("LoadedFiltersFromStorage", null, [sandboxId]);
                }, this, [sandboxId]);
            },
            initFilterVisibility: function() {
                this.set("IsDetailFilterVisible", true);
                this.set("IsFilterAdded", true);
            },
            setFilter: function(key, value, filtersValue) {
                var filters = this.get("DetailFilters");
                if (key) {
                    if (filters.find(key)) {
                        filters.remove(filters.get(key));
                    }
                    filters.add(key, value);
                    // 
                    this.saveFilter(key, filtersValue, value);
                    //
                } else if (value) {
                    value.each(function(filter) {
                        this.setFilter(filter.key, filter);
                    }, this);
                }
            },
            saveFilter: function(filterKey, filterValue, filter) {
                    if (!filterValue) {
                        return;
                    }
                    var sessionFilters = this.getSessionFilters();
                    var profileFilters = this.getProfileFilters();
                    var serializableFilter = this.getSerializableFilter(filter);
                    switch (filterKey) {
                        case "CustomFilters":
                            Terrasoft.each(filterValue, function(item) {
                                var f = item.filter = item.value || "";
                                var isSerializedFilter = (typeof f === "string" && f.indexOf("[") >= 0 && f.indexOf("]") >= 0 &&
                                    f.indexOf("{") >= 0 && f.indexOf("}") >= 0);
                                if (!isSerializedFilter) {
                                    item.filter = Terrasoft.encode(serializableFilter);
                                }
                            });
                            if (this.isNotEmpty(filterValue)) {
                                sessionFilters[filterKey] = profileFilters[filterKey] = filterValue;
                            } else {
                                delete sessionFilters.CustomFilters;
                                delete profileFilters.CustomFilters;
                            }
                            Terrasoft.saveUserProfile(this.getFiltersKey(), profileFilters, false);
                            this.set("ProfileFilters", profileFilters);
                            // sessionFilters[filterKey] = profileFilters[filterKey] = filterValue;
                            // Terrasoft.saveUserProfile(this.getFiltersKey(), profileFilters, false);
                            // this.set("ProfileFilters", profileFilters);
                            break;
                        case "FolderFilters":
                            sessionFilters[filterKey] = profileFilters[filterKey] = filterValue;
                            Terrasoft.saveUserProfile(this.getFiltersKey(), profileFilters, false);
                            this.set("ProfileFilters", profileFilters);
                            break;
                        case "FixedFilters":
                            filterValue.filter = Terrasoft.encode(serializableFilter);
                            profileFilters[filterKey] = {Fixed: filterValue};
                            Terrasoft.saveUserProfile(this.getFiltersKey(), profileFilters, false);
                            this.set("ProfileFilters", profileFilters);
                            break;
                        case "TagFilters":
                            serializableFilter.tags = filterValue;
                            profileFilters[filterKey] = [serializableFilter];
                            Terrasoft.saveUserProfile(this.getFiltersKey(), profileFilters, false);
                            this.set("ProfileFilters", profileFilters);
                            break;
                        default:
                            sessionFilters[filterKey] = profileFilters[filterKey] = [
                                {
                                    filter: filter.serialize()
                                }
                            ];
                            Terrasoft.saveUserProfile(this.getFiltersKey(), profileFilters, false);
                    }
            },
            getSessionFilters: function() {
                var storage = Terrasoft.configuration.Storage.Filters = Terrasoft.configuration.Storage.Filters || {};
                var sessionFilters = storage[this.name] = storage[this.name] || {};
                return sessionFilters;
            },
            getProfileFilters: function() {
                    return this.get("ProfileFilters") || {};
            },
            getSerializableFilter: function(filter) {
                    filter.serializationInfo = {serializeFilterManagerInfo: true};
                    var serializableFilter = {};
                    filter.getSerializableObject(serializableFilter, filter.serializationInfo);
                    return serializableFilter;
            },
            getFiltersKey: function() {
                    var cardName = this.values.CardPageName;
                    var schemaName = this.name;
                    //return cardName + schemaName + "Filters";
                    return schemaName + "Filters";
            }
        },
        diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/
    };
});
 

Like 0

Like

6 comments

HI,

There is no built-in functionality for saving detail filters. Visit BaseGridDetailV2 schema and explore its functionality. As a workaround you can save your filters to cache and use load them from there when open the detail again

Peter Vdovukhin writes:

HI,

There is no built-in functionality for saving detail filters. Visit BaseGridDetailV2 schema and explore its functionality. As a workaround you can save your filters to cache and use load them from there when open the detail again

 

Thanks, I have already done it => these methods are in my replaced BaseGridDetailV2. About cache... so is saving data in SysProfileData  senselessly? To tell the truth, I Understand the main idea,but i don't know the alternative way to solve this problem. So as I Understand SysProfileData is senselessly and i should to find other way?

Somehow didn't see full code in your question. Your case is not about saving filter and setting right [key] for SysProfileData. It is about automatic loading your filters from the profile. In BaseSectionV2 you have loadProfileFilters() function that loads filters by key from storage, but you don't have a similar function in BaseGridDetail. If you want such functionality you should write it.

Peter Vdovukhin,Oh ok, thanks!

Peter Vdovukhin writes:

Somehow didn't see full code in your question. Your case is not about saving filter and setting right [key] for SysProfileData. It is about automatic loading your filters from the profile. In BaseSectionV2 you have loadProfileFilters() function that loads filters by key from storage, but you don't have a similar function in BaseGridDetail. If you want such functionality you should write it.

Excuse me,I have been written logic from Section on my BaseGridDetailV2 module; Here is a code

define("BaseGridDetailV2", ["BaseGridDetailV2Resources", "ConfigurationEnums", "RightUtilities","TagConstantsV2",

    "ProcessModuleUtilities", "GridUtilitiesV2", "WizardUtilities", "QuickFilterModuleV2", "ProcessEntryPointUtilities"

], function(resources, enums, RightUtilities, TagConstantsV2) {

    return {

        messages: {},

        mixins: {},

        attributes: {

            "ProfileFilters": {

                    dataValueType: Terrasoft.DataValueType.CUSTOM_OBJECT

            },

            "IsDetailFiltersLoaded": {

                    dataValueType: Terrasoft.DataValueType.BOOLEAN,

                    value: false

            },

            "DetailFilters": {

                    dataValueType: Terrasoft.DataValueType.COLLECTION

            }

        },

        methods: {

            subscribeSandboxEvents: function() {

                this.callParent(arguments);

                var editPages = this.getEditPages();

                editPages.each(function(editPage) {

                    var typeColumnValue = editPage.get("Tag");

                    var cardModuleId = this.getEditPageSandboxId(editPage);

                    this.sandbox.subscribe("getCardInfo", function() {

                        var detailInfo = this.getDetailInfo();

                        var cardInfo = {

                            valuePairs: detailInfo.defaultValues || []

                        };

                        var typeColumnName = this.get("TypeColumnName");

                        if (typeColumnName && typeColumnValue) {

                            cardInfo.typeColumnName = typeColumnName;

                            cardInfo.typeUId = typeColumnValue;

                        }

                        return cardInfo;

                    }, this, [cardModuleId]);

                }, this);

                this.sandbox.subscribe("CardSaved", this.onCardSaved, this, [this.sandbox.id]);

                this.subscribeGetModuleSchema();

                this.subscribeFiltersChanged();

                this.subscribeGetShortFilterFieldsVisible();

                this.sandbox.subscribe("GetRecordInfo", this.getRecordInfo, this,

                    [this.getRecordRightsSetupModuleId()]);

                this.sandbox.subscribe("GetExtendedFilterConfig", this.getExtendedFilterConfig, this,

                    [this.getQuickFilterModuleId()]);

            },

            init: function(callback, scope) {

                this.callParent([function() {

                    this.mixins.WizardUtilities.canUseWizard(function(result) {

                        this.set("IsDetailWizardAvailable", result);

                        callback.call(scope);

                    }, this);

                }, this]);

                this.registerMessages();

                this.initDetailFilterCollection();

                //

                //this.initDetailFiltersCollection();

                this.loadProfileFilters();

                //

                this.initFilterVisibility();

                this.isFilterAdded();

                var sandboxId = this.getQuickFilterModuleId();

                this.sandbox.subscribe("InitFilterFromStorage", function() {

                    this.sandbox.publish("LoadedFiltersFromStorage", null, [sandboxId]);

                }, this, [sandboxId]);

            },

            loadProfileFilters: function(callback, scope) {

                    var isDetailFiltersLoaded = this.get("IsDetailFiltersLoaded");

                    if (isDetailFiltersLoaded) {

                        Ext.callback(callback, scope);

                        return;

                    }

                    var profileKey = Ext.String.format("profile!{0}", this.getFiltersKey());

                    Terrasoft.require([profileKey], function(profile) {

                        this.onLoadProfileFilters(callback, scope, profile);

                    }, this);

            },

            onLoadProfileFilters: function(callback, scope, profile) {

                    this.loadFiltersContainersVisibility(profile);

                    this.initFilterAttributes(profile);

                    this.set("IsDetailFiltersLoaded", true);

                    Ext.callback(callback, scope);

            },

            loadFiltersContainersVisibility: function(profile) {

                    if (profile) {

                        if (Ext.isDefined(profile.isFoldersContainerExpanded)) {

                            this.set("IsFoldersVisible", profile.isFoldersContainerExpanded);

                        }

                        if (Ext.isDefined(profile.isExtendedFiltersContainerExpanded)) {

                            this.set("IsExtendedFiltersVisible", profile.isExtendedFiltersContainerExpanded);

                        }

                    }

            },

            initFilterAttributes: function(profile) {

                    var sessionFilters = this.getSessionFilters();

                    this.set("SessionFilters", sessionFilters);

                    var profileFilters = Terrasoft.deepClone(profile);

                    var fixedSessionFilters = this._getFixedSessionFilters();

                    Terrasoft.each(profileFilters, this.applyFilters, this);

                    Terrasoft.each(fixedSessionFilters, this.applyFilters, this);

                    this.set("ProfileFilters", profileFilters);

            },

            _getFixedSessionFilters: function() {

                    var sessionFilters = this.getSessionFilters();

                    var primaryDisplayColumn = this.entitySchema.primaryDisplayColumn;

                    var customFilters = sessionFilters.CustomFilters;

                    var customFiltersPrimaryDisplayColumn = customFilters && customFilters.primaryDisplayColumn;

                    if (customFiltersPrimaryDisplayColumn && primaryDisplayColumn) {

                        var sessionFiltersFixed = {};

                        sessionFiltersFixed.CustomFilters = {};

                        sessionFiltersFixed.CustomFilters[primaryDisplayColumn.name] = customFilters;

                        sessionFilters = sessionFiltersFixed;

                    }

                    return sessionFilters;

            },

            applyFilters: function(filterValue, key) {

                    if (key.match(/filters/i) && !this.isNotEmpty(filterValue)) {

                        return;

                    }

                    var detailFiltersValue = this.get("DetailFiltersValue");

                    if (!Ext.isString(filterValue)) {

                        detailFiltersValue.removeByKey(key);

                        this._chooseFilterProccesing(filterValue, key);

                    }

                    if (key !== "FixedFilters") {

                        detailFiltersValue.add(key, filterValue);

                    }

            },

            initDetailFiltersCollection : function(){

                    this.set("ProfileFilters", {});

                    this.set("DetailFilters", this.Ext.create("Terrasoft.FilterGroup"));

                    this.set("DetailFiltersValue", this.Ext.create("Terrasoft.Collection"));

            },

            _chooseFilterProccesing: function(filterValue, key) {

                    var detailFilters = this.get("DetailFilters");

                    Terrasoft.each(filterValue, function(item, propName) {

                        if (item.key === TagConstantsV2.TagFilterKey || key === TagConstantsV2.TagFilterKey) {

                            this.applyTagFilter(key, item);

                        }

                        if (propName === "Fixed") {

                            this._applyFixedFilter(key, item);

                        }

                        if (item.filter) {

                            var filter = Terrasoft.deserialize(item.filter);

                            if (!detailFilters.contains(key)) {

                                detailFilters.add(key, filter);

                            }

                        } else if (item.primaryDisplayColumn) {

                            this.applyPrimaryColumnFilter(key, item);

                        } else if (item.folderInfo || item.folderType) {

                            this.applyFolderFilter(key, item);

                        }

                    }, this);

            },

            //

            initFilterFromStorage: function() {

                    this.loadProfileFilters(function() {

                        this.sandbox.publish("LoadedFiltersFromStorage", null, this.getFilterModulesIds());

                    }, this);

            },

            initFilterVisibility: function() {

                this.set("IsDetailFilterVisible", true);

                this.set("IsFilterAdded", true);

            },

            setFilter: function(key, value, filtersValue) {

                var filters = this.get("DetailFilters");

                if (key) {

                    if (filters.find(key)) {

                        filters.remove(filters.get(key));

                    }

                    filters.add(key, value);

                    // 

                    this.saveFilter(key, filtersValue, value);

                    //

                } else if (value) {

                    value.each(function(filter) {

                        this.setFilter(filter.key, filter);

                    }, this);

                }

            },

            saveFilter: function(filterKey, filterValue, filter) {

                    if (!filterValue) {

                        return;

                    }

                    var sessionFilters = this.getSessionFilters();

                    var profileFilters = this.getProfileFilters();

                    var serializableFilter = this.getSerializableFilter(filter);

                    switch (filterKey) {

                        case "CustomFilters":

                            Terrasoft.each(filterValue, function(item) {

                                var f = item.filter = item.value || "";

                                var isSerializedFilter = (typeof f === "string" && f.indexOf("[") >= 0 && f.indexOf("]") >= 0 &&

                                    f.indexOf("{") >= 0 && f.indexOf("}") >= 0);

                                if (!isSerializedFilter) {

                                    item.filter = Terrasoft.encode(serializableFilter);

                                }

                            });

                            if (this.isNotEmpty(filterValue)) {

                                sessionFilters[filterKey] = profileFilters[filterKey] = filterValue;

                            } else {

                                delete sessionFilters.CustomFilters;

                                delete profileFilters.CustomFilters;

                            }

                            Terrasoft.saveUserProfile(this.getFiltersKey(), profileFilters, false);

                            this.set("ProfileFilters", profileFilters);

                            break;

                        case "FolderFilters":

                            sessionFilters[filterKey] = profileFilters[filterKey] = filterValue;

                            Terrasoft.saveUserProfile(this.getFiltersKey(), profileFilters, false);

                            this.set("ProfileFilters", profileFilters);

                            break;

                        case "FixedFilters":

                            filterValue.filter = Terrasoft.encode(serializableFilter);

                            profileFilters[filterKey] = {Fixed: filterValue};

                            Terrasoft.saveUserProfile(this.getFiltersKey(), profileFilters, false);

                            this.set("ProfileFilters", profileFilters);

                            break;

                        case "TagFilters":

                            serializableFilter.tags = filterValue;

                            profileFilters[filterKey] = [serializableFilter];

                            Terrasoft.saveUserProfile(this.getFiltersKey(), profileFilters, false);

                            this.set("ProfileFilters", profileFilters);

                            break;

                        default:

                            sessionFilters[filterKey] = profileFilters[filterKey] = [

                                {

                                    filter: filter.serialize()

                                }

                            ];

                            Terrasoft.saveUserProfile(this.getFiltersKey(), profileFilters, false);

                    }

            },

            getSessionFilters: function() {

                var storage = Terrasoft.configuration.Storage.Filters = Terrasoft.configuration.Storage.Filters || {};

                var sessionFilters = storage[this.name] = storage[this.name] || {};

                return sessionFilters;

            },

            getProfileFilters: function() {

                    return this.get("ProfileFilters") || {};

            },

            getSerializableFilter: function(filter) {

                    filter.serializationInfo = {serializeFilterManagerInfo: true};

                    var serializableFilter = {};

                    filter.getSerializableObject(serializableFilter, filter.serializationInfo);

                    return serializableFilter;

            },

            getFiltersKey: function() {

                    var cardName = this.values.CardPageName;

                    var schemaName = this.name;

                    return cardName + schemaName + "Filters";

            }

        },

        diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/

    };

});

 

But Terrasoft.configuration.Storage.Filters has got on my detail object - it is empty and there are not any properties with filters. How can I fill it in Storage?

 

 

Hi, Nikita.

Check loadProfileFilters function. Compare calling it from a section to calling from a detail. Especially check what profile is used and how it is stored in a database

 

Show all comments