EssOtlPutSmartList

Populates the contents of the Text List (SmartList) handle created by EssOtlCreateObject. The object handle created can be typecast to an ESS_HSMARTLIST_T handle.

Verification rules:

Syntax

ESS_FUNC_M EssOtlPutSmartList(hOutline, hSmartList, len, *pIDs, *ppszText, pszMissingName, pszOutofRangeName);
ParameterData TypeDescription

hOutline

ESS_HOUTLINE_T

The source Essbase outline for the text list.

hSmartList

ESS_HSMARTLIST_T

Text list handle

len

ESS_UINT16

Number of items

*pIDs

ESS_UINT32_T

Integer IDs

*ppszText

ESS_STR_T

Enumerated text

pszMissingName

ESS_STR_T

Name of the missing smart text

pszOutofRangeName

ESS_STR_T

Name of the out of range smart text.

Return Value

Returns:

Example

void TestPutSmartList()
{
	ESS_STS_T						sts = ESS_STS_NOERR;
	ESS_HOUTLINE_T				hOutline = ESS_NULL;
	ESS_OBJECT_TYPES			objType;
	ESS_HOBJECT_T				hObjHandle;
	ESS_PHOBJECT_T				hObjHandles;
	ESS_PSMARTLISTINFO_T	SmartListInfo = ESS_NULL;
	ESS_OBJDEF_T					Object;
	ESS_HSMARTLIST_T			hSmartList;
	ESS_USHORT_T					len;
	ESS_SMARTLISTID_T			pIds[4];
	ESS_STR_T						ppszText[4];
	ESS_STR_T						pszMissingName;
	ESS_STR_T						pszOutOfRangeName;
	ESS_ULONG_T					Count, i;
	ESS_STR_T						smartListNames[3] = 
			{ "MainColors", "TempColors1", "TempColors2" };

	memset(&Object, '\0', sizeof(Object)); 
	Object.hCtx = 				hCtx;
	Object.ObjType = 			ESS_OBJTYPE_OUTLINE;
	Object.AppName = 			szAppName;
	Object.DbName = 			szDbName;
	Object.FileName = 		szFileName;
 
	/* Open outline */
	sts = EssOtlOpenOutline(hCtx, &Object, ESS_TRUE, 
				ESS_TRUE, &hOutline);
 
	/* Create a SmartList */
	objType = OBJECT_SMARTLIST;
	sts = EssOtlCreateObject(hOutline, objType, 
				smartListNames[0], &hObjHandle);

	/* Set up and put SmartList */
	hSmartList = (ESS_HSMARTLIST_T)hObjHandle;
	len = 4;
	pIds[0] = 1;
	pIds[1] = 2;
	pIds[2] = 3;
	pIds[3] = -1;
	ppszText[0] = "Red";
	ppszText[1] = "Green";
	ppszText[2] = "Blue";
	ppszText[3] = "Yellow";
	pszMissingName = "Missing";
	pszOutOfRangeName = "OutOfRange";
	sts = EssOtlPutSmartList(hOutline, hSmartList, 
					len, pIds, ppszText, pszMissingName, 
					pszOutOfRangeName);

	SaveOutline(hOutline);

	/* Clean up */
	for(i = 0; i <= 12; i++)
	{
		sts = EssOtlFindObject(hOutline, objType, 
					smartListNames[i], &hObjHandle);	
		hSmartList = (ESS_HSMARTLIST_T)hObjHandle;
		sts = EssOtlDeleteObject(hOutline, hSmartList);
	}

	SaveOutline(hOutline);

	objType = OBJECT_SMARTLIST;
	sts = EssOtlListObjects(hOutline, objType, 
				&Count, &hObjHandles);
	for (i = 0; i < Count; i++)
		DisplaySmartListInfo(hOutline, hObjHandles[i]);
	if(hObjHandles)
		EssFree (hInst, hObjHandles);

	sts = EssUnlockObject(hCtx, Object.ObjType, 
				Object.AppName, Object.DbName, Object.FileName); 
	sts = EssOtlCloseOutline(hOutline);
}