EssGetCurrencyRateInfo

Description

EssGetCurrencyRateInfo() gets a list of structures containing rate information for all members of the tagged currency partition dimension in the active database outline.

Syntax

ESS_FUNC_M EssGetCurrencyRateInfo (hCtx, pCount, ppRateInfo);
ESS_HCTX_ThCtx
ESS_PLONG_TpCount
ESS_PPRATEINFO_T ppRateInfo

Parameters

hCtxEssbase API context handle.
pCountAddress of variable to receive the count of rate info structures.
ppRateInfoAddress of pointer to receive allocated array of currency rate info structures.

Return Value

If successful, this function returns a count of structures in pCount, and an allocated array of currency rate info structures in ppRateInfo.

Notes

Access

This function requires the caller to have at least read access (ESS_PRIV_READ) to the database, and to have selected it as their active database using EssSetActive().

Example

ESS_FUNC_M
ESS_GetCrRate (ESS_HCTX_T  hCtx,
               ESS_HINST_T hInst
              )
{
   ESS_FUNC_M        sts = ESS_STS_NOERR;
   ESS_LONG_T       count, i, j;
   ESS_PRATEINFO_T  pRateInfoList = NULL;
   ESS_CHAR_T       rateStr[(2 + ESS_MBRNAMELEN) * ESS_CRDB_MAXDIMNUM];
sts = EssGetCurrencyRateInfo (hCtx, &count, &pRateInfoList);
if (!sts)
   {
      if (count)
      {
         for (i = 0; i < count; i++)
         {
            rateStr[0] = '\0';
            for (j = 0; j < ESS_CRDB_MAXDIMNUM; j++)
            {
               if (pRateInfoList[i].RateMbr[j][0])
               {
                  if (rateStr[0])
                     strcat(rateStr, "->");

                  strcat(rateStr, pRateInfoList[i].RateMbr[j]);
               }
            }
            if (!rateStr[0])
               strcpy(rateStr, "(LOCAL)");
            if (i == 0)
            {
               /* 1st is always DB rate */
               printf ("database [%s] : %s\r\n", pRateInfoList[i].MbrName, rateStr);
            }
            else
            {
               printf ("Partition [%s] : %s\r\n", pRateInfoList[i].MbrName, rateStr);
            }
         } 
      }
   }
   if (pRateInfoList)
      EssFree (hInst, pRateInfoList);
  return (sts);
}

See Also

EssListCurrencyDatabases()
EssSetActive()