diff --git a/entity/AttributeRelation_entity/AttributeRelation_entity.aod b/entity/AttributeRelation_entity/AttributeRelation_entity.aod index a9171ba77ef57604e0dd9a688b7d0fc9a84fb55e..c13c98c8e85d98a9ec58064b1ce447edbd77fca9 100644 --- a/entity/AttributeRelation_entity/AttributeRelation_entity.aod +++ b/entity/AttributeRelation_entity/AttributeRelation_entity.aod @@ -36,6 +36,7 @@ <resolution>DAY</resolution> <possibleItemsProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attributerelation_value/possibleItemsProcess.js</possibleItemsProcess> <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attributerelation_value/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attributerelation_value/displayValueProcess.js</displayValueProcess> <onValueChange>%aditoprj%/entity/AttributeRelation_entity/entityfields/attributerelation_value/onValueChange.js</onValueChange> </entityField> <entityField> diff --git a/entity/AttributeRelation_entity/entityfields/attributerelation_value/displayValueProcess.js b/entity/AttributeRelation_entity/entityfields/attributerelation_value/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2abb4fdc0d3d1c93c9145629c785866cd50514ee --- /dev/null +++ b/entity/AttributeRelation_entity/entityfields/attributerelation_value/displayValueProcess.js @@ -0,0 +1,11 @@ +import("system.db"); +import("system.result"); +import("system.vars"); +import("Attribute_lib"); +import("Sql_lib"); + +var attributeId = vars.get("$field.AB_ATTRIBUTE_ID"); +var attrType = AttributeHandler.begin(attributeId).getAttributeType(); + +if (attrType == AttributeTypes.COMBO) + result.string(AttributeUtil.getSimpleAttributeName(vars.get("$field.ID_VALUE"))); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/attribute_parent_id/displayValueProcess.js b/entity/Attribute_entity/entityfields/attribute_parent_id/displayValueProcess.js index c220255e0cc463df414f28ab79f209beb4e10ce6..1777b7dcc56af3c224587cb52fe84df5cadffa92 100644 --- a/entity/Attribute_entity/entityfields/attribute_parent_id/displayValueProcess.js +++ b/entity/Attribute_entity/entityfields/attribute_parent_id/displayValueProcess.js @@ -2,4 +2,4 @@ import("system.result"); import("system.vars"); import("Attribute_lib"); -result.string(AttributeUtil.getAttributeNameById(vars.get("$field.ATTRIBUTE_PARENT_ID"))) \ No newline at end of file +result.string(AttributeUtil.getSimpleAttributeName(vars.get("$field.ATTRIBUTE_PARENT_ID"))) \ No newline at end of file diff --git a/process/Attribute_lib/process.js b/process/Attribute_lib/process.js index dac5966054c8d01f41d4db7d903935db62c57cc6..239006faaef2b329f42d2c9103c07c2b4de7a247 100644 --- a/process/Attribute_lib/process.js +++ b/process/Attribute_lib/process.js @@ -31,6 +31,7 @@ AttributeUtil.getPossibleAttributes = function (pObjectType, pIncludeGroups) + " join AB_ATTRIBUTEUSAGE on AB_ATTRIBUTEID = AB_ATTRIBUTE_ID"; attrCond = SqlCondition.begin() .andPrepare("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", pObjectType) + .and("ATTRIBUTE_TYPE != '" + AttributeTypes.COMBOVALUE + "'") .and("ATTRIBUTE_ACTIVE = 1"); if (!pIncludeGroups) @@ -38,19 +39,19 @@ AttributeUtil.getPossibleAttributes = function (pObjectType, pIncludeGroups) var attributes = db.array(db.COLUMN, attrCond.buildSql(attrSql)).map(function (id) { - return [id, AttributeUtil.getAttributeNameById(id)]; + return [id, AttributeUtil.getFullAttributeName(id)]; }); return attributes; } /** - * returns the name of an attribute + * returns the name of an attribute with all parent attribute names * * @param {String} pAttributeId the id of the attribute * * @return {String} the name of the attribute */ -AttributeUtil.getAttributeNameById = function (pAttributeId) +AttributeUtil.getFullAttributeName = function (pAttributeId) { var attributeNames = []; var attribute; @@ -59,9 +60,9 @@ AttributeUtil.getAttributeNameById = function (pAttributeId) attribute = db.array(db.ROW, SqlCondition.begin() .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", pAttributeId, "# = ?", idType) .buildSql("select ATTRIBUTE_NAME, ATTRIBUTE_PARENT_ID from AB_ATTRIBUTE") - ); + ); if (attribute.length > 0) - { + { attributeNames.push(attribute[0]); pAttributeId = attribute[1]; } @@ -72,6 +73,23 @@ AttributeUtil.getAttributeNameById = function (pAttributeId) return attributeNames.reverse().join(" / "); } +/** + * returns the name of an attribute + * + * @param {String} pAttributeId the id of the attribute + * + * @return {String} the name of the attribute + */ +AttributeUtil.getSimpleAttributeName = function (pAttributeId) +{ + var attributeName = db.cell(SqlCondition.begin() + .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", pAttributeId) + .buildSql("select ATTRIBUTE_NAME from AB_ATTRIBUTE") + ); + + return attributeName; +} + /** * gets the value of an attribute for one dataset (e. g. a person) */