# EssGetAssociatedAttributesInfo

Description

EssGetAssociatedAttributesInfo() returns the attribute members associated with a given base member.

Syntax

ESS_FUNC_M EssGetAssociatedAttributesInfo (hCtx, BaseMbrName, AttrDimName, pCount, ppAttrInfo);

ESS_HCTX_T | hCtx;
ESS_STR_T | BaseMbrName;
ESS_STR_T | AttrDimName;
ESS_PULONG_T | pCount;
ESS_PPATTRIBUTEINFO_T | ppAttrInfo;

Parameters

hCtx | Context handle
BaseMbrName | Base member name
AttrDimName | (Optional) attribute dimension name
pCount | Number of attribute members returned
ppAttrInfo | Attribute information

Return Value

Notes

- Call this function to retrieve more information for attribute members than you retrieve using EssQueryDatabaseMembers().
- Set AttrDimName to NULL to return all attribute members that are associated with the base member.
- Optionally, provide an attribute dimension name to retrieve information only about the member of that dimension which is associated with the base member.

Access

This function requires no special privileges.

Example

    //void  ESS_GetAssociateAttributeInfo();
    ESS_GetAssociatedAttributesInfo ()
    {
       ESS_STS_T             sts;
       ESS_ULONG_T           pCount=0;
       ESS_PATTRIBUTEINFO_T  pAttributeInfo;
       ESS_USHORT_T          index=0;
       ESS_CHAR_T            time_string[32];
       struct tm*            pTime;
       ESS_DATETIME_T        et;
       ESS_PATTRSPECS_T      pAttrSpecs;
       ESS_USHORT_T          usDateFormat;
       ESS_MBRNAME_T         attributeName;
       ESS_MBRNAME_T         dimensionName;

       pAttributeInfo = NULL;
       strcpy(attributeName, "100-10");
       strcpy(dimensionName, "\0");

       sts = EssGetAssociatedAttributesInfo(hCtx, attributeName, dimensionName, &pCount, &pAttributeInfo);

       /* for handling time values */
       et = pAttributeInfo->Attribute.value.dtData;
       if (!sts)
       {
          printf ("\nAssociated Attr info for [%s]\n", attributeName);
          printf ("------------------------------------\n");
          for (index=0; index<pCount; index++)
          {
             printf ("MbrName      : %s\n", pAttributeInfo[index].MbrName);
             printf ("DimName      : %s\n", pAttributeInfo[index].DimName);

             switch(pAttributeInfo[index].Attribute.usDataType)
             {
                 case ESS_ATTRMBRDT_BOOL:
                   printf ("Data Type    : Boolean \n");
                   if ( pAttributeInfo[index].Attribute.value.bData)
                      printf ("Data Value   : True \n");
                   else
                      printf ("Data Value   : False \n");
                   break;

                 case ESS_ATTRMBRDT_DOUBLE:
                   printf ("Data Type    : Numeric(Double) \n");
                   printf ("Data Value   : %g \n",pAttributeInfo[index].Attribute.value.dblData);
                   break;

                 case ESS_ATTRMBRDT_DATETIME:
                   printf ("Data Type    : Date \n");
                   sts = EssGetAttributeSpecifications(hCtx, &pAttrSpecs);
                   if (sts)
                      usDateFormat = ESS_DATEFORMAT_MMDDYYYY;
                   else
                      usDateFormat = pAttrSpecs->usDateFormat;

                   pTime =  gmtime((time_t*)&et);
                   switch(usDateFormat)
                   {
                      case ESS_DATEFORMAT_MMDDYYYY:
                         sprintf(time_string, "MM-DD-YYYY %02i-%02i-%04i",
                            pTime->tm_mon+1, pTime->tm_mday,pTime->tm_year+1900);
                         break;
                      case ESS_DATEFORMAT_DDMMYYYY :
                         sprintf(time_string, "DD-MM-YYYY %02i-%02i-%04i",
                            pTime->tm_mday,pTime->tm_mon+1, pTime->tm_year+1900);
                         break;
                   }
                   printf ("Data Value   : %s \n", time_string);
                   break;

                 case ESS_ATTRMBRDT_STRING:
                   printf ("Data Type    : String \n");
                   printf ("Data Value   : %s \n", pAttributeInfo[index].Attribute.value.strData);
                   EssFree(hInst, pAttributeInfo[index].Attribute.value.strData);
                   break;
                 }
             printf("\n");
          }
       }
       if (pAttributeInfo)
          EssFreeStructure(hInst, ESS_DT_STRUCT_ATTRIBUTEINFO, 1, pAttributeInfo);
       return (sts);
    }

See Also

EssCheckAttributes()
EssFreeStructure()
EssGetAttributeInfo()
EssGetAttributeSpecifications()
EssOtlAssociateAttributeDimension()
EssOtlAssociateAttributeMember()
EssOtlDisassociateAttributeDimension()
EssOtlDisassociateAttributeMember()
EssOtlFindAttributeMembers()
EssOtlFreeStructure()
EssOtlGetAssociatedAttributes()
EssOtlGetAttributeInfo()
EssOtlGetAttributeSpecifications()
EssOtlQueryAttributes()
EssOtlSetAttributeSpecifications()