EssGetAssociatedAttributesInfo

Returns the attribute members associated with a given base member.

Syntax

ParameterData TypeDescription

hCtx;

ESS_HCTX_T

Context handle

BaseMbrName;

ESS_STR_T

Base member name

AttrDimName;

ESS_STR_T

(Optional) attribute dimension name

pCount;

ESS_PULONG_T

Number of attribute members returned

ppAttrInfo;

ESS_ATTRIBUTEINFO_T

Attribute information

Notes

 

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