Filter in a editable grid detail

Hi, everybody!

 

Given:

There is a detail with an editable grid

It is necessary to apply some filter to the records of the part reference field, but only if there are no records in another part (OrderProduct object) (for a specific Order)

Solution attempt:

An attribute with lookup List Config has been added to the details page:

<br />
      "PrbProduct": {<br />
        "dataValueType": Terrasoft.DataValueType.LOOKUP,<br />
        "lookupListConfig": {<br />
          "filters": [<br />
            function() {<br />
              var subFilterGroup = this.Terrasoft.createFilterGroup();<br />
              subFilterGroup.addItem(this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "Order", this.$PrbOrder.value));<br />
              var filterGroup = this.Terrasoft.createFilterGroup();<br />
              filterGroup.logicalOperation = this.Terrasoft.LogicalOperatorType.OR;<br />
              filterGroup.addItem(this.Terrasoft.createNotExistsFilter("[OrderProduct].Id", subFilterGroup));<br />
              filterGroup.addItem(this.Terrasoft.createColumnFilterWithParameter("PrbOrder", this.$PrbOrder.value));<br />
              return filterGroup;<br />
            }<br />
          ]<br />
        }<br />
      },<br />

 

Problem:

It is not possible to find the correct path to the column in create Not Exists Filter. Or there is an error like "Column on the path [Order Product].Id was not found in the "Product" schema, or (with some other values) the filter does not work as needed.

Tell me, please, is it even possible to create Not Exists Filter/createExistsFilter without binding to the detail object?

How to correctly specify the "path to the column" in this case?

Like 0

Like

4 comments
Best reply

Fariz Mamedov,

 

Just open the console in browser (F12 in Chrome) and go to the "Network" tab. And then find the correspondent SelectQuery request and review its body:

Hello Fariz,

 

The task is to create a filter starting from the object of the lookup column for which we are creating the lookupListConfig. The easiest way to properly build path to the needed column is creating the same filter, but using advanced filters in the section. This will result in the SelectQuery request where filters can be reviewed and the content of the filter copied which will show you an accurate path to the column needed.

Oleg Drobina,

Thank you! Interesting trick.

Please, provide details about: "This will result in the SelectQuery request where filters can be reviewed" - how exactly I can review such a request? 

Fariz Mamedov,

 

Just open the console in browser (F12 in Chrome) and go to the "Network" tab. And then find the correspondent SelectQuery request and review its body:

Oleg Drobina, Super thx!

Show all comments