Associates an attribute member to a base member, with the validity of the associations specified by the given validity set.
Syntax
ESS_FUNC_M EssOtlVaryingAssociateAttribute (hOutline, hBaseMember, hAttrMember, mode, pValiditySet);| Parameter | Data Type | Description |
|---|---|---|
hOutline | ESS_HOUTLINE_T | Outline context handle |
hBaseMember | ESS_HMEMBER_T | Handle to the base member |
hAttrMember | ESS_HMEMBER_T | Handle to the attribute member |
mode | ESS_INT_T | Association mode. Possible values:
|
pValiditySet | ESS_VALIDITYSET_T | Pointer to the validity set that defines the independent dimension for which the association is valid |
Notes
When a full range is specified, the association is made as specified.
Association mode determines how to handle open-ended situations when only the starting tuple is specified instead of a full range. (For these description examples, assume the following associations of the Ounces attribute members associated with product 100-10 prior to association):
Jan Feb Mar Apr May 12 12 16 16 20
MODE_OVERWRITE—Association starts from the specified member through all members that follow it. Example: Associating 12 starting with Mar.
Result: Mar and all members after it are associated with 12. Conflicting associations are overwritten:
Jan Feb Mar Apr May
12 12 12 12 12MODE_NOOVERWRITE—Association starts at the specified tuple and continues until the existing associated attribute member is different. Example: Associating 12 starting with Mar.
Result: Both Mar and Apr had the same attribute so association continues until May where it was different:
Jan Feb Mar Apr May
12 12 12 12 20Return Value
Returns 0 if successful.
Example
void TestEssOtlVaryingAssociateAttribute()
{
ESS_STS_T sts = ESS_STS_NOERR;
ESS_HOUTLINE_T hOutline = ESS_NULL;
ESS_OBJDEF_T Object;
ESS_HMEMBER_T hBaseMbr, hAttrMbr, hBaseDim, hAttrDim, hIndDim = ESS_NULL;
ESS_INT_T mode;
ESS_VALIDITYSET_T ValiditySet;
ESS_HMEMBER_T IndDimsArray[2];
ESS_STR_T IndepMbrsArray[4];
ESS_INT32_T countOfIndDims;
ESS_USHORT_T usValiditySetType;
ESS_UCHAR_T pucIndependentTypes[2];
memset(&Object, '\0', sizeof(Object));
Object.hCtx = hCtx;
Object.ObjType = ESS_OBJTYPE_OUTLINE;
Object.AppName = szAppName;
Object.DbName = szDbName;
Object.FileName = szDbName;
printf("\n");
sts = EssOtlOpenOutline(hCtx, &Object, ESS_TRUE, ESS_TRUE, &hOutline);
printf("EssOtlOpenOutline sts: %ld\n",sts);
/* Disassociate base dimension from attribute dimension before test.*/
printf("\nDisassociate base dimension from attribute dimension before test:");
sts = EssOtlFindMember(hOutline, "Entities", &hBaseDim);
printf("\nEssOtlFindMember sts: %d\n", sts);
sts = EssOtlFindMember(hOutline, "Type", &hAttrDim);
printf("EssOtlFindMember sts: %d\n", sts);
sts = EssOtlDisassociateAttributeDimension(hOutline, hBaseDim, hAttrDim);
printf("EssOtlDisassociateAttributeDimension sts: %d\n", sts);
/* Get handle for base member*/
printf("\nGet handle for base member:\n");
sts = EssOtlFindMember(hOutline, "Doe,Jane", &hBaseMbr);
printf("EssOtlFindMember sts: %d\n", sts);
/* Get handle for indep dimensions*/
printf("\nGet handle for indep dimensions:\n");
sts = EssOtlFindMember(hOutline, "Time Periods", &IndDimsArray[0]);
printf("EssOtlFindMember sts: %d\n", sts);
sts = EssOtlFindMember(hOutline, "Years", &IndDimsArray[1]);
printf("EssOtlFindMember sts: %d\n", sts);
/* Associate the dimension Entities and Type*/
printf("\nAssociate the dimensions:\n");
countOfIndDims = 2;
pucIndependentTypes[0] = ESS_ASSOCIATE_TYPE_DISCRETE;
pucIndependentTypes[1] = ESS_ASSOCIATE_TYPE_CONTINUOUS;
sts = EssOtlVaryingAssociateAttributeDimension(hOutline, hBaseDim, hAttrDim, countOfIndDims, IndDimsArray, pucIndependentTypes);
printf("EssOtlVaryingAssociateAttributeDimension sts: %d\n", sts);
/* Initial valid case with ValiditySetType of member handles*/
printf("\n*** Initial valid case with ValiditySetType of member handles ***\n");
printf("\nGet handle for attribute member:\n");
sts = EssOtlFindMember(hOutline, "Regular", &hAttrMbr);
printf("EssOtlFindMember sts: %d\n", sts);
sts = EssOtlFindMember(hOutline, "Jan", &hIndepMbrsArray[0]);
sts = EssOtlFindMember(hOutline, "FY03", &hIndepMbrsArray[1]);
sts = EssOtlFindMember(hOutline, "Jan", &hIndepMbrsArray[2]);
sts = EssOtlFindMember(hOutline, "FY06", &hIndepMbrsArray[3]);
memset(&ValiditySet, '\0', sizeof(ValiditySet));
ValiditySet.countOfIndepDims = 2;
ValiditySet.usValiditySetType = ESS_VALIDITYSET_TYPE_MBRHDLS;
ValiditySet.countOfIndepRanges = 1;
ValiditySet.pIndepMbrs = hIndepMbrsArray;
printf("\nBefore association:");
usValiditySetType = ESS_VALIDITYSET_TYPE_MBRHDLS;
DisplayVaryingAttributes(hOutline, hBaseMbr, hAttrDim, ESS_NULL, usValiditySetType);
mode = ESS_ASSOCIATE_MODE_NOOVERWRITE;
sts = EssOtlVaryingAssociateAttribute(hOutline, hBaseMbr, hAttrMbr, mode, &ValiditySet);
printf("EssOtlVaryingAssociateAttribute sts: %d\n", sts);
/* Restructure and save outline */
SaveOutline(hOutline);
sts = EssUnlockObject(hCtx, ESS_OBJTYPE_OUTLINE, Object.AppName, Object.DbName, Object.FileName);
printf("\nEssUnlockObject sts: %d\n", sts);
sts = EssOtlCloseOutline(hOutline);
printf("EssOtlCloseOutline sts: %d\n",sts);
}
See Also