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

Hello

 

I am trying to update a lookup field linked to Employee section for multiple records using an input box. But, the list of records are not displaying either by typing in the field or clicking on magnifying glass icon. 

I have tried using every property for binding this to the object. But none of them works. I have attached the code snippet of this custom action for reference.

 

So please suggest a way to bind it to the correct schema and display its correct records.

 

Regards,

Malay

File attachments
Like 0

Like

4 comments

Hi Malay, 

 

Lookups are usually looking like that.

 

You can add "isSimpleLookup" to the virtual lookup attribute to make it a drop-down ,  so it might be much convenient for you.

 

Example:

 

"YourLookup": {
    dataValueType: Terrasoft.DataValueType.LOOKUP,
    isSimpleLookup: true,
    referenceSchemaName: "Employee"
}

 

Best Regards, 

 

Bogdan L

Hi Bogdan Lesyk,

 

Thank you for your response.

 

I was asking about the binding of object with this virtual lookup. As, this is not properly bind with any object, it is not showing any values.

I have also inserted the property referenceSchemaName: "Employee" but it still does not show any values.

 

Regards,

Malay

Malay,

 

If you don't see any values of your Lookup, you've probably added wrong name of the object your Lookup should referring to.

 

Please check out the example of how it should looks like:

 

https://community.creatio.com/articles/virtualcolumn-lookup-field

 

Also check out the code my test implementation:

 

 attributes: {

                "UsrTestLookup": {

                    "dataValueType": Terrasoft.DataValueType.LOOKUP,

                    "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,

                    isLookup: true,

                    caption: "virtual street",

                    referenceSchemaName: "Employee",

          isSimpleLookup: true

                }

            },

 

diff: /**SCHEMA_DIFF*/[

      {

                    "operation": "insert",

                    "parentName": "ProfileContainer",

                    "propertyName": "items",

                    "name": "UsrTestLookup",

                    "values": {

                        bindTo: "UsrTestLookup",

                        "caption": {"bindTo": "Resources.Strings.UsrTestLookupCaption"},

                        layout: {column: 0, row: 8, colSpan: 12}

                    }

                },

 

As far as I choose

 "parentName": "ProfileContainer"

and

isSimpleLookup: true,

please check out the result of such implementation.

 

 

So on Contact page I've got my "some lookup test" which has it's values from "Employee" object which it refers to.

 

Also please note,  that Virtual Lookup columns most often exist to store intermediate values, that can be further used for data processing.

 

Best Regards, 

 

Bogdan L.

 

 

Hi Bogdan,



How to add filter to the virtual Lookups, I had followed the above method to add virtual lookup. And when I tried to add filter to that, its not filtering out the data.

I have attached my code for the reference,





After adding the filter I am able to see all the values in the Lookup.

Is there a way, to Filter the Lookup values in Virtual lookup column ?



Regards,

Adharsh S

Show all comments