Skip to content
Snippets Groups Projects
Commit 701541df authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon: Committed by Sebastian Pongratz
Browse files

[Projekt: xRM-Sales][TicketNr.: 1085759][Themenbaum Paging der Nodes einbauen...

[Projekt: xRM-Sales][TicketNr.: 1085759][Themenbaum Paging der Nodes einbauen und Filter manuell implementieren]
parent cf475c81
No related branches found
No related tags found
No related merge requests found
Showing
with 1827 additions and 0 deletions
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<include relativeToChangelogFile="true" file="create_TopicTree.xml"/>
<include relativeToChangelogFile="true" file="create_TopicTreeRelation.xml"/>
</databaseChangeLog>
\ No newline at end of file
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="b.ulrich" id="9aa9ce72-670d-4122-a50f-0b1e1ca64ca3">
<createTable tableName="TOPICTREE">
<column name="TOPICTREEID" type="CHAR(36)">
<constraints primaryKey="true" primaryKeyName="PK_TOPICTREEID"/>
</column>
<column name="ASSIGNEDTO" type="CHAR(36)">
</column>
<column name="TOPIC" type="VARCHAR(36)"/>
<column name="DESCRIPTION" type="NVARCHAR(500)"/>
<!-- Boolean (1 = true, 0 = false)-->
<column name="ACTIVE" type="TINYINT" defaultValueNumeric="1">
<constraints nullable="false"/>
</column>
<column name="SORTING_LAYER_1" type="INTEGER"/>
<column name="SORTING_LAYER_2" type="INTEGER"/>
<column name="SORTING_LAYER_3" type="INTEGER"/>
<column name="SORTING_LAYER_4" type="INTEGER"/>
<column name="SORTING_LAYER_5" type="INTEGER"/>
<column name="SORTING_LAYER_6" type="INTEGER"/>
<column name="USER_NEW" type="NVARCHAR(50)" />
<column name="DATE_NEW" type="DATETIME" />
<column name="USER_EDIT" type="NVARCHAR(50)" />
<column name="DATE_EDIT" type="DATETIME" />
</createTable>
<createIndex tableName="TOPICTREE" indexName="IDX_TOPICTREE_ASSIGNEDTO">
<column name="ASSIGNEDTO"/>
</createIndex>
</changeSet>
</databaseChangeLog>
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="b.ulrich" id="ced229de-1e0b-4e7f-9dbc-233fe6f2c7ba">
<createTable tableName="TOPICTREERELATION">
<column name="TOPICTREERELATIONID" type="CHAR(36)">
<constraints primaryKey="true" primaryKeyName="PK_TOPICTREERELATIONID"/>
</column>
<column name="TOPICTREE_ID" type="CHAR(36)"/>
<column name="OBJECT_ROWID" type="CHAR(36)"/>
<column name="OBJECT_TYPE" type="VARCHAR(63)"/>
<column name="DESCRIPTION" type="NCLOB"/>
<column name="SORT" type="INTEGER"/>
<column name="USER_NEW" type="NVARCHAR(50)" />
<column name="DATE_NEW" type="DATETIME" />
<column name="USER_EDIT" type="NVARCHAR(50)" />
<column name="DATE_EDIT" type="DATETIME" />
</createTable>
<createIndex tableName="TOPICTREERELATION" indexName="IDX_TOPICTREERLTN_TREE_ID">
<column name="TOPICTREE_ID"/>
</createIndex>
<createIndex tableName="TOPICTREERELATION" indexName="IDX_TOPICTREERLTN_OBJROW_ID">
<column name="OBJECT_ROWID"/>
</createIndex>
<createIndex tableName="TOPICTREERELATION" indexName="IDX_TOPICTREERLTN_OBJTYPE_ID">
<column name="OBJECT_TYPE"/>
</createIndex>
</changeSet>
</databaseChangeLog>
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<include relativeToChangelogFile="true" file="TopicTree/changelog.xml"/>
</databaseChangeLog>
\ No newline at end of file
......@@ -103,6 +103,7 @@
<include file="generatedData/tasklink.xml" relativeToChangelogFile="true"/>
<include file="generatedData/ticket.xml" relativeToChangelogFile="true"/>
<include file="generatedData/timetracking.xml" relativeToChangelogFile="true"/>
<include file="generatedData/topictree.xml" relativeToChangelogFile="true"/>
<include file="generatedData/unrelatedduplicates.xml" relativeToChangelogFile="true"/>
<include file="generatedData/visitplanemployeeweek.xml" relativeToChangelogFile="true"/>
<include file="generatedData/visitplanentry.xml" relativeToChangelogFile="true"/>
......
This diff is collapsed.
......@@ -27,6 +27,7 @@
<include relativeToChangelogFile="true" file="basic/2021.1.1/changelog.xml"/>
<include relativeToChangelogFile="true" file="basic/2021.1.2/changelog.xml"/>
<include relativeToChangelogFile="true" file="basic/2021.1.3/changelog.xml"/>
<include relativeToChangelogFile="true" file="basic/2021.2.0/changelog.xml"/>
<include relativeToChangelogFile="true" file="basic/workflows/changelog.xml" context="workflow"/>
<include relativeToChangelogFile="true" file="basic/_demoData/changelog.xml" context="example"/>
......
......@@ -22238,6 +22238,396 @@
</entityFieldDb>
</entityFields>
</entityDb>
<entityDb>
<name>TOPICTREE</name>
<dbName></dbName>
<idColumn>TOPICTREEID</idColumn>
<idGeneratorType v="0" />
<idGeneratorInterval v="1" />
<documentation></documentation>
<title></title>
<description></description>
<auditSyncConfig>
<name>auditSyncConfig</name>
<auditMode v="0" />
<syncActive v="false" />
<syncComplete v="true" />
<syncDirection v="1" />
<syncIds></syncIds>
</auditSyncConfig>
<entityFields>
<entityFieldDb>
<name>TOPICTREEID</name>
<dbName></dbName>
<primaryKey v="true" />
<columnType v="1" />
<size v="36" />
<scale v="0" />
<notNull v="true" />
<isUnique v="true" />
<index v="true" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>ACTIVE</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="5" />
<size v="5" />
<scale v="0" />
<notNull v="true" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>DATE_EDIT</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="93" />
<size v="29" />
<scale v="9" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>SORTING_LAYER_5</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="4" />
<size v="10" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>SORTING_LAYER_6</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="4" />
<size v="10" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>TOPIC</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="12" />
<size v="36" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>SORTING_LAYER_1</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="4" />
<size v="10" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>SORTING_LAYER_2</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="4" />
<size v="10" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>SORTING_LAYER_3</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="4" />
<size v="10" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>USER_EDIT</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="12" />
<size v="50" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>SORTING_LAYER_4</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="4" />
<size v="10" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>DESCRIPTION</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="12" />
<size v="500" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>ASSIGNEDTO</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="1" />
<size v="36" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="true" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>DATE_NEW</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="93" />
<size v="29" />
<scale v="9" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>USER_NEW</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="12" />
<size v="50" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
</entityFields>
</entityDb>
<entityDb>
<name>TOPICTREERELATION</name>
<dbName></dbName>
<idColumn>TOPICTREERELATIONID</idColumn>
<idGeneratorType v="0" />
<idGeneratorInterval v="1" />
<documentation></documentation>
<title></title>
<description></description>
<auditSyncConfig>
<name>auditSyncConfig</name>
<auditMode v="0" />
<syncActive v="false" />
<syncComplete v="true" />
<syncDirection v="1" />
<syncIds></syncIds>
</auditSyncConfig>
<entityFields>
<entityFieldDb>
<name>OBJECT_ROWID</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="1" />
<size v="36" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="true" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>TOPICTREE_ID</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="1" />
<size v="36" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="true" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>DATE_EDIT</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="93" />
<size v="29" />
<scale v="9" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>DESCRIPTION</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="2005" />
<size v="2147483647" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>TOPICTREERELATIONID</name>
<dbName></dbName>
<primaryKey v="true" />
<columnType v="1" />
<size v="36" />
<scale v="0" />
<notNull v="true" />
<isUnique v="true" />
<index v="true" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>DATE_NEW</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="93" />
<size v="29" />
<scale v="9" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>USER_NEW</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="12" />
<size v="50" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>OBJECT_TYPE</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="12" />
<size v="63" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="true" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>USER_EDIT</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="12" />
<size v="50" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>SORT</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="4" />
<size v="10" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
</entityFields>
</entityDb>
</entities>
</entityGroup>
</aliasDefDb>
......
......@@ -377,6 +377,10 @@
<name>Checklist</name>
<kind v="10077" />
</entityNode>
<entityNode>
<name>TopicTree</name>
<kind v="10077" />
</entityNode>
</childNodes>
</entityNode>
<entityNode>
......
......@@ -698,6 +698,39 @@
<name>AdvActivityId_param</name>
<expose v="true" />
</entityParameter>
<entityConsumer>
<name>Topics</name>
<onValidation>%aditoprj%/entity/Activity_entity/entityfields/topics/onValidation.js</onValidation>
<dependency>
<name>dependency</name>
<entityName>TopicTreeRelation_entity</entityName>
<fieldName>TopicRelation</fieldName>
</dependency>
<children>
<entityParameter>
<name>ObjectType_param</name>
<valueProcess>%aditoprj%/entity/Activity_entity/entityfields/topics/children/objecttype_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>ObjectRowId_param</name>
<valueProcess>%aditoprj%/entity/Activity_entity/entityfields/topics/children/objectrowid_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityConsumer>
<name>AllTopics</name>
<dependency>
<name>dependency</name>
<entityName>TopicTree_entity</entityName>
<fieldName>#PROVIDER</fieldName>
</dependency>
<children>
<entityParameter>
<name>Expanded_param</name>
<valueProcess>%aditoprj%/entity/Activity_entity/entityfields/alltopics/children/expanded_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
......@@ -847,6 +880,24 @@
<isLookupFilter v="false" />
<filtertype>BASIC</filtertype>
</filterExtension>
<filterExtension>
<name>Topic_filter</name>
<title>Topic</title>
<contentType>TEXT</contentType>
<useConsumer v="true" />
<consumer>AllTopics</consumer>
<filterConditionProcess>%aditoprj%/entity/Activity_entity/recordcontainers/db/filterextensions/topic_filter/filterConditionProcess.js</filterConditionProcess>
<filtertype>BASIC</filtertype>
</filterExtension>
<filterExtension>
<name>TopicIncludingSubTopics_filter</name>
<title>Topic (incl. Subtopics)</title>
<contentType>TEXT</contentType>
<useConsumer v="true" />
<consumer>AllTopics</consumer>
<filterConditionProcess>%aditoprj%/entity/Activity_entity/recordcontainers/db/filterextensions/topicincludingsubtopics_filter/filterConditionProcess.js</filterConditionProcess>
<filtertype>BASIC</filtertype>
</filterExtension>
</filterExtensions>
</dbRecordContainer>
</recordContainers>
......
import("system.result");
result.string(true);
\ No newline at end of file
import("system.vars");
import("system.result");
result.string(vars.get("$field.ACTIVITYID"));
\ No newline at end of file
import("Context_lib");
import("system.result");
result.string(ContextUtils.getCurrentContextId());
\ No newline at end of file
import("TopicTree_lib");
import("system.result");
result.string(TopicTreeUtils.validateTopicCount("Topics"));
\ No newline at end of file
import("Context_lib");
import("Sql_lib");
import("system.result");
import("system.vars");
var rawValue = vars.get("$local.rawvalue");
var operator = vars.get("$local.comparison");
var topicSql = newSelect("TOPICTREERELATION.TOPICTREE_ID")
.from("TOPICTREERELATION")
.where("TOPICTREERELATION.OBJECT_TYPE", ContextUtils.getCurrentContextId())
if(operator == "ISNOTNULL")
{
topicSql = topicSql.and("TOPICTREERELATION.OBJECT_ROWID != ACTIVITY.ACTIVITYID")
}
else if(operator != "ISNULL")
{
topicSql = topicSql.and("TOPICTREERELATION.TOPICTREE_ID", rawValue)
.and("TOPICTREERELATION.OBJECT_ROWID = ACTIVITY.ACTIVITYID");
}
else
{
topicSql = topicSql.and("TOPICTREERELATION.OBJECT_ROWID = ACTIVITY.ACTIVITYID");
}
var condType = SqlBuilder.EXISTS();
if (operator != "EQUAL")
{
condType = SqlBuilder.NOT_EXISTS();
}
result.string(newWhere(null, topicSql, condType));
\ No newline at end of file
import("TopicTree_lib");
import("Sql_lib");
import("system.result");
import("system.vars");
var rawValue = vars.get("$local.rawvalue");
var operator = vars.get("$local.comparison");
var topicSql = newSelect("TOPICTREERELATION.TOPICTREE_ID")
.from("TOPICTREERELATION")
.where("TOPICTREERELATION.OBJECT_TYPE", "Activity")
if(operator == "ISNOTNULL")
{
topicSql = topicSql.and("TOPICTREERELATION.OBJECT_ROWID != ACTIVITY.ACTIVITYID")
}
else if(operator != "ISNULL")
{
var topicTreeIds = [rawValue];
var topics = [rawValue];
//update child topics accordingly
while(topicTreeIds && topicTreeIds.length > 0)
{
topicTreeIds = newSelect("TOPICTREEID")
.from("TOPICTREE")
.where("TOPICTREE.ASSIGNEDTO", topicTreeIds, SqlBuilder.IN())
.arrayColumn();
if(topicTreeIds && topicTreeIds.length > 0)
{
for (let i = 0; i < topicTreeIds.length; i++)
{
topics.push(topicTreeIds[i]);
}
}
}
topicSql = topicSql.and("TOPICTREERELATION.TOPICTREE_ID", topics, SqlBuilder.IN())
.and("TOPICTREERELATION.OBJECT_ROWID = ACTIVITY.ACTIVITYID");
}
else
{
topicSql = topicSql.and("TOPICTREERELATION.OBJECT_ROWID = ACTIVITY.ACTIVITYID");
}
var condType = SqlBuilder.EXISTS();
if (operator != "EQUAL")
{
condType = SqlBuilder.NOT_EXISTS();
}
result.string(newWhere(null, topicSql, condType));
\ No newline at end of file
......@@ -1411,6 +1411,20 @@
<name>IgnoreOrderBy_param</name>
<expose v="true" />
</entityParameter>
<entityConsumer>
<name>AllTopics</name>
<dependency>
<name>dependency</name>
<entityName>TopicTree_entity</entityName>
<fieldName>#PROVIDER</fieldName>
</dependency>
<children>
<entityParameter>
<name>Expanded_param</name>
<valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/alltopics/children/expanded_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
......@@ -1774,6 +1788,24 @@
<documentation>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/visitrecommendation_filter/documentation.adoc</documentation>
<filtertype>BASIC</filtertype>
</filterExtension>
<filterExtension>
<name>Topic_filter</name>
<title>Activity: Topic</title>
<contentType>TEXT</contentType>
<useConsumer v="true" />
<consumer>AllTopics</consumer>
<filterConditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/topic_filter/filterConditionProcess.js</filterConditionProcess>
<filtertype>BASIC</filtertype>
</filterExtension>
<filterExtension>
<name>TopicIncludingSubTopics</name>
<title>Activity: Topic (incl. Subtopics)</title>
<contentType>TEXT</contentType>
<useConsumer v="true" />
<consumer>AllTopics</consumer>
<filterConditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/topicincludingsubtopics/filterConditionProcess.js</filterConditionProcess>
<filtertype>BASIC</filtertype>
</filterExtension>
</filterExtensions>
</dbRecordContainer>
<indexRecordContainer>
......
import("system.result");
result.string(true);
\ No newline at end of file
import("Context_lib");
import("Sql_lib");
import("system.result");
import("system.vars");
var rawValue = vars.get("$local.rawvalue");
var operator = vars.get("$local.comparison");
var topicSql = newSelect("ACTIVITYLINK.ACTIVITYLINKID")
.from("ACTIVITYLINK")
.join("ACTIVITY", "ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID")
.join("TOPICTREERELATION", "TOPICTREERELATION.OBJECT_ROWID = ACTIVITY.ACTIVITYID")
.where("ACTIVITYLINK.OBJECT_TYPE", ContextUtils.getCurrentContextId());
if(operator == "ISNOTNULL")
{
topicSql = topicSql.and("ACTIVITYLINK.OBJECT_ROWID != CONTACT.CONTACTID");
}
else if(operator != "ISNULL")
{
topicSql = topicSql.and("TOPICTREERELATION.TOPICTREE_ID", rawValue)
.and("ACTIVITYLINK.OBJECT_ROWID = CONTACT.CONTACTID");
}
else
{
topicSql = topicSql.and("ACTIVITYLINK.OBJECT_ROWID = CONTACT.CONTACTID");
}
var condType = SqlBuilder.EXISTS();
if (operator != "EQUAL")
{
condType = SqlBuilder.NOT_EXISTS();
}
result.string(newWhere(null, topicSql, condType));
\ No newline at end of file
import("Context_lib");
import("Sql_lib");
import("system.result");
import("system.vars");
var rawValue = vars.get("$local.rawvalue");
var operator = vars.get("$local.comparison");
var topicSql = newSelect("ACTIVITYLINK.ACTIVITYLINKID")
.from("ACTIVITYLINK")
.join("ACTIVITY", "ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID")
.join("TOPICTREERELATION", "TOPICTREERELATION.OBJECT_ROWID = ACTIVITY.ACTIVITYID")
.where("ACTIVITYLINK.OBJECT_TYPE", ContextUtils.getCurrentContextId());
if(operator == "ISNOTNULL")
{
topicSql = topicSql.and("ACTIVITYLINK.OBJECT_ROWID != CONTACT.CONTACTID");
}
else if(operator != "ISNULL")
{
var topicTreeIds = [rawValue];
var topics = [rawValue];
//update child topics accordingly
while(topicTreeIds && topicTreeIds.length > 0)
{
topicTreeIds = newSelect("TOPICTREEID")
.from("TOPICTREE")
.where("TOPICTREE.ASSIGNEDTO", topicTreeIds, SqlBuilder.IN())
.arrayColumn();
if(topicTreeIds && topicTreeIds.length > 0)
{
for (let i = 0; i < topicTreeIds.length; i++)
{
topics.push(topicTreeIds[i]);
}
}
}
topicSql = topicSql.and("TOPICTREERELATION.TOPICTREE_ID", topics, SqlBuilder.IN())
.and("ACTIVITYLINK.OBJECT_ROWID = CONTACT.CONTACTID");
}
else
{
topicSql = topicSql.and("ACTIVITYLINK.OBJECT_ROWID = CONTACT.CONTACTID");
}
var condType = SqlBuilder.EXISTS();
if (operator != "EQUAL")
{
condType = SqlBuilder.NOT_EXISTS();
}
result.string(newWhere(null, topicSql, condType));
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment