Question

Complex lookup filter

Hi all,

 

I need to filter a lookup like this : 

Select "Id", *
from "UsrMatieresDesMarches" root
where
exists
(
    Select "Id" from "UsrMarchesEtActivitesDuCompte" account_market_activity
    where exists
    (
        Select "Id" 
        from "UsrActivitesDesMarches" param_market_activity
        where 
            param_market_activity."UsrMarcheId" = root."UsrMarcheId"
            and param_market_activity."Id" = account_market_activity."UsrActiviteDuMarcheId"
    )
    and account_market_activity."UsrAccountId" = '60687534-82ca-446d-bd62-010e032fe52d'
)

I struggle on what reverse path I can take. Anyone sees it ?

 

 

Like 0

Like

1 comments
Best reply

Hello Jerome,

To filter your lookup values you need to write an attribute on the object page schema, for example:

"StTransport": {
                "dataValueType": Terrasoft.DataValueType.LOOKUP,
                "lookupListConfig": {
                    "filters": [
                        function() {
                            var filterGroup = Ext.create("Terrasoft.FilterGroup");
                            filterGroup.add("MaxWeightFilter",
                                Terrasoft.createColumnFilterWithParameter(
                                    Terrasoft.ComparisonType.GREATER,
                                    "[StTransport:Id].StMaxWeight",
                                    this.get("StWeight")));
                            return filterGroup;
                        }
                    ]
                }

Take a look at a construction [StTransport:Id] it's an example of reverse connections and I believe that in your situation you should use it.

You can see another small example with it in this article.

To add another condition to the filter just wright another filterGroup.add.

Hello Jerome,

To filter your lookup values you need to write an attribute on the object page schema, for example:

"StTransport": {
                "dataValueType": Terrasoft.DataValueType.LOOKUP,
                "lookupListConfig": {
                    "filters": [
                        function() {
                            var filterGroup = Ext.create("Terrasoft.FilterGroup");
                            filterGroup.add("MaxWeightFilter",
                                Terrasoft.createColumnFilterWithParameter(
                                    Terrasoft.ComparisonType.GREATER,
                                    "[StTransport:Id].StMaxWeight",
                                    this.get("StWeight")));
                            return filterGroup;
                        }
                    ]
                }

Take a look at a construction [StTransport:Id] it's an example of reverse connections and I believe that in your situation you should use it.

You can see another small example with it in this article.

To add another condition to the filter just wright another filterGroup.add.

Show all comments