Hi;
I try to assign filter to lookup field i try this way:
diff: /**SCHEMA_DIFF*/[
{
"operation": "insert",
"name": "UsrRepairFacilityLookUp",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 6,
"row": 0,
"layoutName": "Header"
},
"bindTo": "UsrRepairFacility",
"enabled": true,
"contentType": 3,
"lookupListConfig": {
"filters": [
function() {
var filterGroup = Ext.create("Terrasoft.FilterGroup");
var today = new Date();
filterGroup.add("IsValidToNull",
Terrasoft.createColumnIsNullFilter("UsrValidTo"));
filterGroup.logicalOperation = Terrasoft.LogicalOperatorType.OR;
filterGroup.add("IsValidToInFutere",
Terrasoft.CreateFilterWithParameters(FilterComparisonType.GreaterOrEqual,"UsrValidTo",today))
return filterGroup;
}
]
}
},
"parentName": "Header",
"propertyName": "items",
"index": 0
},
but it doesn't work
i put this lookuplistconfig also outside values tag with the same effect
can you help me
regards;
Tomek
Like
I also try somethink like this
define("UsrRepackDevicePage", [], function() {
return {
entitySchemaName: "",
attributes: {
"UsrRepairFacility": {
dataValueType: this.Terrasoft.DataValueType.LOOKUP,
"lookupListConfig": {
"filters": [
function() {
var filterGroup = Ext.create("Terrasoft.FilterGroup");
var today = new Date();
filterGroup.add("IsValidToNull",
Terrasoft.createColumnIsNullFilter("UsrValidTo"));
filterGroup.logicalOperation = Terrasoft.LogicalOperatorType.OR;
filterGroup.add("IsValidToInFutere",
Terrasoft.CreateFilterWithParameters(Terrasoft.FilterComparisonType.GreaterOrEqual, "UsrValidTo", today));
return filterGroup;
}
]
}
}
},
details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
diff: /**SCHEMA_DIFF*/[
{
"operation": "insert",
"name": "UsrRepairFacilityLookUp",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 6,
"row": 0,
"layoutName": "Header"
},
"bindTo": "UsrRepairFacility",
"enabled": true,
"contentType": 3
},
"parentName": "Header",
"propertyName": "items",
"index": 0
},
{
"operation": "insert",
"name": "BOOLEAN4d33e50e-a800-4ad1-961a-a2a90b1351dd",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 2,
"layoutName": "Header"
},
"bindTo": "UsrNoServiceOnList",
"enabled": true
},
"parentName": "Header",
"propertyName": "items",
"index": 1
},
{
"operation": "insert",
"name": "STRINGa649b89f-205f-440b-ac51-5fe125546258",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 3,
"layoutName": "Header"
},
"bindTo": "UsrSericeName",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 2
},
{
"operation": "insert",
"name": "STRING7e8f5349-0a18-4c55-afe1-fe20e1cff879",
"values": {
"layout": {
"colSpan": 7,
"rowSpan": 1,
"column": 10,
"row": 4,
"layoutName": "Header"
},
"bindTo": "UsrServiceStreetNo",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 3
},
{
"operation": "insert",
"name": "STRING10277fd3-4039-476c-b66a-73064a3c3830",
"values": {
"layout": {
"colSpan": 7,
"rowSpan": 1,
"column": 17,
"row": 4,
"layoutName": "Header"
},
"bindTo": "UsrServiceAppartmentNo",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 4
},
{
"operation": "insert",
"name": "STRING2f6c170c-9cc6-4a05-8fc0-7506c753f1b2",
"values": {
"layout": {
"colSpan": 10,
"rowSpan": 1,
"column": 0,
"row": 4,
"layoutName": "Header"
},
"bindTo": "UsrServiceStreet",
"enabled": true
},
"parentName": "Header",
"propertyName": "items",
"index": 5
},
{
"operation": "insert",
"name": "STRING3cd63a1b-b045-4e26-b280-b8518a19c655",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 5,
"layoutName": "Header"
},
"bindTo": "UsrServiceZipCode",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 6
},
{
"operation": "insert",
"name": "STRING25ba586f-e7c0-4b41-8be8-75490544dca6",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 12,
"row": 5,
"layoutName": "Header"
},
"bindTo": "UsrServiceCity",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 7
}
]/**SCHEMA_DIFF*/,
methods: {},
rules: {},
businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/
};
});
Hello Tomas,
The second code seems to be correct. But I noticed, that you missed the entitySchemaName. Please, define it in your schema.
Also please, make sure that the column name in the filterGroup config is correct ("UsrValidTo").
As an alternative, you can try to set up filtration business rule for your lookup field. Please, see the documentation (https://academy.bpmonline.com/documents/technic-sdk/7-12/filtration-rul…)
If it doesn't help, please write an email to support team with specifying your web site instance and credentials to it.
Tetiana Markova,
Thanks;
I don’t think the solution is ok for me. It is Process preconfigured page not connect to any entity
I try to create the view in database base on it object and connect lookup field to it.
By the way
can you suggest me how create such condition?
A and (B or C) using filter terasoft.filtergroup
Regards
Tomek
So, you are are trying to filter lookup fields on the Pre-Configured page. That makes things more clear. What is your current version?
I tried the same code for the Pre-Configured page and it didn't work for me on 7.12.2.891 version as well. But it works on 7.12.2.935.
Please, try to set up the Pre-Configured page with lookup filtration on the demo with 7.12.2.935 version or higher to see if it works for you as well. I believe, you just need to update to the latest version.
Regarding your second question.
You need to create a separate filter group with logical operator OR and add this group to the parent group by AND rule.
Please, see my example:
var filterGroup = Ext.create("Terrasoft.FilterGroup");
filterGroup.logicalOperation = Terrasoft.LogicalOperatorType.AND;
// create (B or C)
var subFilterGroup = Ext.create("Terrasoft.FilterGroup");
subFilterGroup.logicalOperation = Terrasoft.LogicalOperatorType.OR;
subFilterGroup.add("B filter", Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "Some column name", "some parameter"));
subFilterGroup.add("C filter", Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "Some column name", "some parameter"));
//add A filter
filterGroup.addItem("A filter", Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, Some column name", "some parameter"));
// add (B or C) to A
filterGroup.addItem(subFilterGroup);
return filterGroup;
Also, there are no functions as Terrasoft.CreateFilterWithParameters and Terrasoft.FilterComparisonType
Please, change your "IsValidToInFutere" filter:
Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.GREATER_OR_EQUAL, "UsrValidTo", today)