Returns a member name and key. A key is a value generated by Essbase that uniquely identifies a member name in the outline.
Syntax
ESSG_FUNC_M EssGGetFromMemberwKey (pszOutStr, pszMember, pszKey);
Parameter | Data Type | Description |
---|---|---|
pszOutStr ; | ESSG_STR_T | Input string of the format: <member-name length><member-name><key length ><key>, where the length elements are 2 bytes in size. Note that <member-name> is null-terminated. The string is returned from the API or can be created using EssGCreateMemberwKeyStr. |
pszMember; | ESSG_STR_T | Member name (output). |
pszKey; | ESSG_STR_T | Member key (output). |
Notes
When the usType field of the ESSG_DATA_T structure is set to ESSG_DT_MEMBERwKEY, then the pszStr field of Value(ESSG_DATA_VALUE) field is interpreted as the format required for pszOutStr.
Example
ESSG_VOID_T ESSG_BeginZoomIn(ESSG_HGRID_T hGrid) { ESSG_STS_T sts = ESS_STS_NOERR; ESSG_DATA_T **ppDataIn; ESSG_DATA_T **ppDataOut; ESSG_RANGE_T rDataRangeIn, rDataRangeOut; ESSG_ULONG_T ulOptions; ESSG_USHORT_T usCells; ESSG_RANGE_T pZoomCells; ESSG_USHORT_T usState; ESSG_USHORT_T usMember2Len, usKey2Len; ESSG_SHORT_T sOption, sOptionGet; ESSG_SHORT_T tmpShort, tmpShortGet, i; ESSG_PVOID_T pOption, pOptionGet; ESSG_STR_T pMember, pKey, pOutStr; ESSG_STR_T pMember2, pKey2; /* connect the grid to a database on the server */ sts = EssGConnect(hGrid, server, "essexer", pwd, app, db, ESSG_CONNECT_NODIALOG); /* set grid option*/ tmpShort = ESSG_TRUE; sOption = ESSG_OP_MEMBERANDUNIQUENAME ; pOption = (ESSG_PVOID_T)tmpShort; // pOption holds the actual value not a pointer sts = EssGSetGridOption(hGrid, sOption, pOption); printf("EssGSetGridOption sts %ld\n",sts); sOptionGet = ESSG_OP_MEMBERANDUNIQUENAME ; pOptionGet = &tmpShortGet; if(!sts) { sts = EssGGetGridOption(hGrid, sOptionGet, pOptionGet); printf("EssGGetGridOption sts %ld\n",sts); printf("EssGSetGridOption set ESSG_OP_MEMBERANDUNIQUENAME TO %d\n",(int)tmpShortGet); } if(sts == 0) { ppDataIn = BuildTable(&rDataRangeIn); ulOptions = ESSG_ZOOM_DOWN | ESSG_NEXTLEVEL; pZoomCells.ulRowStart = 0; pZoomCells.ulColumnStart = 2; pZoomCells.ulNumRows = 1; pZoomCells.ulNumColumns = 1; usCells = 1; /* start the zoom in operation */ sts = EssGBeginZoomIn(hGrid, usCells, &pZoomCells, ulOptions); printf("EssGBeginZoomIn sts: %ld\n",sts); } //Display Input DisplayOutput(ppDataIn, rDataRangeIn); printf("\n\n"); if(sts == 0) /* send the entire grid to define the query */ sts = EssGSendRows(hGrid, &rDataRangeIn, ppDataIn); if(sts == 0) { /* perform the zoom-in */ sts = EssGPerformOperation(hGrid, 0); /* Free the built data */ FreeTwoDim(ppDataIn, rDataRangeIn.ulNumRows); } if (sts == 0) { /* determine the results of the zoom-in */ sts = EssGGetResults(hGrid, 0, &rDataRangeOut, &usState); } if(sts ==0) { /* get all the data */ sts = EssGGetRows(hGrid, 0, &rDataRangeOut, &rDataRangeOut, &ppDataOut); } if(sts == 0) { DisplayOutput(ppDataOut, rDataRangeOut); /* Retreive member and key from cell */ sts = EssGGetFromMemberwKey (((ppDataOut[1][0]).Value).pszStr, &pMember, &pKey); printf("After EssGGetFromMemberwKey\n Member: %s, Key: %s \n\n", pMember+2, pKey+2); //Member is "Qtr1", Key is "[2004].[Qtr1]", pOutStr is in the format //nn<member-name>nn<'key> - where nn is string length usMember2Len = strlen("Qtr1"); pMember2 = malloc(usMember2Len+3); memset(pMember2, 0, usMember2Len+3); usKey2Len = strlen("[2004].[Qtr1]"); pKey2 = malloc(usKey2Len+3); memset(pKey2, 0, usKey2Len+3); memcpy(pMember2, &usMember2Len, 2); memcpy(pMember2+2, "Qtr1", usMember2Len); memcpy(pKey2, &usKey2Len, 2); memcpy(pKey2+2, "[2004].[Qtr1]", usKey2Len); sts = EssGCreateMemberwKeyStr(pMember2, pKey2, &pOutStr); /*Note: because not all elements in pOutStr are actual characters, e.g. the 2 bytes for the size of Member and size of Key, plus the \0 ending characters, the printf below does not display the actual contents of the array */ for (i=0;i < usMember2Len + usKey2Len + 4 + 2; ++i) printf("%c", pOutStr[i]); /* Free the returned data */ EssGFreeRows(hGrid, &rDataRangeOut, ppDataOut); sts = EssGFreeMemberwKeyStr (pOutStr); } if( sts == 0) { EssGEndOperation(hGrid, 0); EssGDisconnect(hGrid, 0); } }
See Also