Skip to content
Snippets Groups Projects
Commit 5ad8a1a2 authored by S.Listl's avatar S.Listl
Browse files

Attribute groups

parent 523d8107
No related branches found
No related tags found
No related merge requests found
Showing
with 122 additions and 13 deletions
......@@ -50,6 +50,12 @@
<fieldName>Attributes</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>236a52d8-830d-4e46-bf9b-7ffaeef25477</name>
<entityName>Attribute_entity</entityName>
<fieldName>AttributeChildren</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
</entityProvider>
<entityParameter>
......
......@@ -14,6 +14,7 @@
<name>ATTRIBUTE_NAME</name>
<title>Name</title>
<mandatory v="true" />
<displayValueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attribute_name/displayValueProcess.js</displayValueProcess>
</entityField>
<entityField>
<name>ATTRIBUTE_TYPE</name>
......@@ -23,26 +24,47 @@
</entityField>
<entityField>
<name>AB_ATTRIBUTEID</name>
<searchable v="false" />
<valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/ab_attributeid/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>ATTRIBUTE_PARENT_ID</name>
<title>Parent Attribute</title>
<consumer>AttributeChildren</consumer>
<linkedContext>Attribute_context</linkedContext>
<groupable v="true" />
<valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attribute_parent_id/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attribute_parent_id/displayValueProcess.js</displayValueProcess>
</entityField>
<entityConsumer>
<name>AttributeChildren</name>
<title>Attributes</title>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<fieldName></fieldName>
<entityName>Attribute_entity</entityName>
<fieldName>AttributeParent</fieldName>
</dependency>
<children>
<entityParameter>
<name>attrParentId_param</name>
<code>%aditoprj%/entity/Attribute_entity/entityfields/attributechildren/children/attrparentid_param/code.js</code>
<triggerRecalculation v="true" />
<mandatory v="false" />
</entityParameter>
</children>
</entityConsumer>
<entityProvider>
<name>AttributeParent</name>
<fieldType>DEPENDENCY_IN</fieldType>
<recordContainer>db</recordContainer>
<dependencies>
<entityDependency>
<name>18bd148d-bed3-429f-ba54-c5eac76c5083</name>
<entityName>Attribute_entity</entityName>
<fieldName>AttributeChildren</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
</entityProvider>
<entityParameter>
<name>attrParentId_param</name>
......@@ -108,10 +130,6 @@
<name>AB_ATTRIBUTEID.value</name>
<recordfield>AB_ATTRIBUTE.AB_ATTRIBUTEID</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>ATTRIBUTE_NAME.value</name>
<recordfield>AB_ATTRIBUTE.ATTRIBUTE_NAME</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>ATTRIBUTE_PARENT_ID.value</name>
<recordfield>AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID</recordfield>
......@@ -128,6 +146,10 @@
<name>ATTRIBUTE_TYPE.displayValue</name>
<expression>%aditoprj%/entity/Attribute_entity/recordcontainers/db/recordfieldmappings/attribute_type.displayvalue/expression.js</expression>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>ATTRIBUTE_NAME.value</name>
<recordfield>AB_ATTRIBUTE.ATTRIBUTE_NAME</recordfield>
</dbRecordFieldMapping>
</recordFieldMappings>
</dbRecordContainer>
</recordContainers>
......
import("system.vars");
import("system.result");
import("Attribute_lib");
result.string(AttributeUtil.getAttributeNameById(vars.get("$field.AB_ATTRIBUTEID")));
\ No newline at end of file
import("system.neon");
import("system.result");
import("system.vars");
import("Attribute_lib");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.attrParentId_param") && vars.get("$param.attrParentId_param"))
result.string(AttributeUtil.getAttributeNameById(vars.get("$param.attrParentId_param")));
import("system.neon");
import("system.logging");
import("system.result");
import("system.vars");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.attrParentId_param") && vars.get("$param.attrParentId_param"))
result.string(vars.get("$param.attrParentId_param"));
\ No newline at end of file
import("system.vars");
import("system.result");
result.string(vars.getString("$field.AB_ATTRIBUTEID"));
\ No newline at end of file
......@@ -2,5 +2,7 @@ import("system.vars");
import("system.result");
import("Sql_lib");
//if (vars.exists("$field.AB_ATTRIBUTEID") && vars.get("$field.AB_ATTRIBUTEID") != "")
// result.string(SqlCondition.begin().andPrepare("ATTRIBUTE_PARENT_ID", vars.get("$field.AB_ATTRIBUTEID")));
\ No newline at end of file
if (vars.exists("$param.attrParentId_param") && vars.get("$param.attrParentId_param"))
result.string("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID = '" + vars.getString("$param.attrParentId_param") + "'");
else
result.string("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID is null");
\ No newline at end of file
......@@ -5,4 +5,4 @@ import("Keyword_lib");
var cType = vars.get("$field.CONTRACTTYPE");
var cCode = vars.get("$field.CONTRACTCODE");
result.string(KeywordUtils.getViewValue($KeywordRegistry.get.ContractType, cType) + " : " + cCode);
\ No newline at end of file
result.string(KeywordUtils.getViewValue($KeywordRegistry.get.ContractType, cType) + " " + cCode);
\ No newline at end of file
......@@ -8,6 +8,7 @@
<filterview>AttributeFilter_view</filterview>
<editview>AttributeEdit_view</editview>
<preview>AttributePreview_view</preview>
<lookupview>AttributeFilter_view</lookupview>
<entity>Attribute_entity</entity>
<references>
<neonViewReference>
......@@ -26,5 +27,9 @@
<name>05d998e7-7364-4425-aefe-3cf284933d52</name>
<view>AttributeMain_view</view>
</neonViewReference>
<neonViewReference>
<name>6ab8d733-544c-4e48-ade9-b5210a5e5355</name>
<view>AttributeTree_view</view>
</neonViewReference>
</references>
</neonContext>
......@@ -13,6 +13,10 @@
<editMode v="true" />
<entityField>#ENTITY</entityField>
<fields>
<entityFieldLink>
<name>2d269ed7-a664-40c3-aadb-f274f7c00a66</name>
<entityField>ATTRIBUTE_PARENT_ID</entityField>
</entityFieldLink>
<entityFieldLink>
<name>0c6cd7c6-cced-4719-b0c5-08f8e3d13f2f</name>
<entityField>ATTRIBUTE_NAME</entityField>
......
......@@ -15,9 +15,9 @@
<view>AttributePreview_view</view>
</neonViewReference>
<neonViewReference>
<name>d8009eea-f473-4f65-8796-a1ab48ef3b49</name>
<entityField>#ENTITY</entityField>
<view>AttributeFilter_view</view>
<name>634c58b7-74db-42d3-a90c-029678e4fed4</name>
<entityField>AttributeChildren</entityField>
<view>AttributeTree_view</view>
</neonViewReference>
<neonViewReference>
<name>5dee1c0b-c670-4eb9-bd95-6f6474709aa2</name>
......
......@@ -11,7 +11,7 @@
<cardViewTemplate>
<name>Attr_template</name>
<titleField>ATTRIBUTE_NAME</titleField>
<descriptionField>ATTRIBUTE_TYPE</descriptionField>
<subtitleField>ATTRIBUTE_TYPE</subtitleField>
<entityField>#ENTITY</entityField>
</cardViewTemplate>
</children>
......
<?xml version="1.0" encoding="UTF-8"?>
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.0.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.0.1">
<name>AttributeTree_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<boxLayout>
<name>layout</name>
</boxLayout>
</layout>
<children>
<treetableViewTemplate>
<name>Treetable</name>
<parentField>ATTRIBUTE_PARENT_ID</parentField>
<titleField>ATTRIBUTE_NAME</titleField>
<descriptionField>ATTRIBUTE_TYPE</descriptionField>
<entityField>#ENTITY</entityField>
</treetableViewTemplate>
</children>
</neonView>
......@@ -36,6 +36,34 @@ AttributeUtil.getPossibleAttributes = function (pObjectType)
return db.table(attrSql);
}
/**
* returns the name of an attribute
*
* @param {String} pAttributeId the id of the attribute
*
* @return {String} the name of the attribute
*/
AttributeUtil.getAttributeNameById = function (pAttributeId)
{
var attributeNames = [];
var attribute;
do {
attribute = db.array(db.ROW, SqlCondition.begin()
.andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", pAttributeId)
.buildSql("select ATTRIBUTE_NAME, ATTRIBUTE_PARENT_ID from AB_ATTRIBUTE")
);
if (attribute.length > 0)
{
attributeNames.push(attribute[0]);
pAttributeId = attribute[1];
}
else
pAttributeId = "";
} while (pAttributeId);
return attributeNames.reverse().join(" / ");
}
/**
* gets the value of an attribute for one dataset (e. g. a person)
*/
......
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