Skip to main content

Consumer filter

A Consumer filter makes filter criteria of a dependent Entity available. This extends the available filtering options of the current Entity.

Example

In Context Person, titled Contact in the Global Menu, users can filter contact persons according to the topic of a connected Activity:

Image

This was made possible by the following steps:

  • In the RecordContainer, the ConsumerMapping for Consumer Activities was initialized.
  • In the property sheet of this ConsumerMapping, filtertype was set to EXTENDED.
  • In the property sheet of this ConsumerMapping, isFilterable was set to true.
  • The ConsumerMapping defines a filterConditionProcess.

Image

import { result, vars } from "@aditosoftware/jdito-types";
import { newSelect, newWhere, SqlBuilder } from "SqlBuilder_lib";

let subselect = newSelect("CONTACT.PERSON_ID")
.from("CONTACT")
.join("ACTIVITYLINK", "ACTIVITYLINK.OBJECT_ROWID = CONTACT.CONTACTID")
.and("ACTIVITYLINK.OBJECT_TYPE", "Person")
.join("ACTIVITY", "ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID")
.where(vars.get("$local.condition"));

let sql = newWhere("PERSONID", subselect, SqlBuilder.IN());

result.string(sql.toString());