Performs or verifies an allocation on an aggregate storage database.
Syntax
ESS_FUNC_M EssPerformAllocationASO (hCtx, verifyOnly, errorList, allocStruct);
Parameter | Data Type | Description |
---|---|---|
hCtx | ESS_HCTX_T | API context handle. |
verifyOnly | ESS_BOOL_T | Flag to indicate validation of allocation parameters without performing allocation. If it is set to ESS_TRUE, the allocation parameters are validated only. If it is ESS_FALSE, the allocation is verified and executed. |
errorList | ESS_PERF_ALLOC_ERROR_T** | A pointer to the linked list of error structures that will be allocated and returned by the API function. This is so the client has more information about warning and error messages. This argument cannot be 0. The linked list must be freed by the client. |
allocStruct | ESS_PERF_ALLOC_T* | Structure specifying the allocation parameters. |
Return Value
Returns 0 if successful; otherwise, returns an error.
Example
void HandleErrors(ESS_HINST_T hInst, ESS_PERF_ALLOC_ERROR_T **pErrorList) { if (pErrorList) { ESS_PERF_ALLOC_ERROR_T *errorList = *pErrorList; ESS_PERF_ALLOC_ERROR_T *nextError; while (errorList) { printf("Error number %ld occurred\n", errorList->messageNumber); if (errorList->argument != ESS_PERF_ALLOC_ARG_NA) printf(" in argument %d\n", errorList->argument); if (errorList->lineNumber) printf(" on line %ld\n", errorList->lineNumber); if (errorList->token[0] != '\0') printf(" on token %s\n", errorList->token); nextError = errorList->nextError; ESS_STS_T sts = EssFree (hInst, errorList); printf("\nEssFree sts for errorList %ld\n",sts); errorList = nextError; } *pErrorList = NULL; } } void ESS_GLAllocation() { ESS_STS_T sts = ESS_STS_NOERR; ESS_BOOL_T verifyOnly; ESS_PERF_ALLOC_ERROR_T *errorList = ESS_NULL; ESS_PERF_ALLOC_T *allocStruct; sts = EssAlloc (hInst, sizeof(ESS_PERF_ALLOC_T), (ESS_PPVOID_T)&allocStruct); printf("EssAlloc sts for allocStruct: %ld\n", sts); verifyOnly = ESS_FALSE; errorList = ESS_NULL; allocStruct->pov = "[[Account]]@[1100]]].Children"; allocStruct->amount = "100"; allocStruct->amountContext = ""; allocStruct->amountTimeSpan = ""; allocStruct->target = "([Allocated], [041509GR PL2], [11], [[All Department Values]].[000]]], [0000], [Base], [USD], [Total])"; allocStruct->targetTimeSpan = "{[Feb-08]}"; allocStruct->targetTimeSpanOption = ESS_ASO_ALLOCATION_TIMESPAN_DIVIDEAMT; allocStruct->offset = "([Mar-08], [041509GR PL2], [11], [[All Department Values]].[000]]], [0000], [Base], [USD], [Total], [291], [Allocated])"; allocStruct->debitMember = "[Beginning Balance Dr]"; allocStruct->creditMember = "[Beginning Balance Cr]"; allocStruct->range = "DESCENDANTS([Accessories], [Product].Levels(0))"; allocStruct->excludedRange = ""; allocStruct->basis = "([041509GR PL2], [11], [[All Department Values]].[000]]], [0000], [Base], [USD], [Total], [Beginning Balance Cr], [4140], [Actual])"; allocStruct->basisTimeSpan = "{[Feb-08]}"; allocStruct->basisTimeSpanOption = ESS_ASO_ALLOCATION_TIMESPAN_COMBINEBASIS; allocStruct->allocationMethod = ESS_ASO_ALLOCATION_METHOD_SHARE; allocStruct->spreadSkipOption = 0; allocStruct->zeroAmountOption = ESS_ASO_ALLOCATION_ZEROAMT_DEFAULT; allocStruct->zeroBasisOption = ESS_ASO_ALLOCATION_ZEROBASIS_NEXTAMT; allocStruct->negativeBasisOption = ESS_ASO_ALLOCATION_NEGBASIS_DEFAULT; allocStruct->roundMethod = ESS_ASO_ALLOCATION_ROUND_NONE; allocStruct->roundDigits = ""; allocStruct->roundToLocation = ""; allocStruct->groupID = 0; allocStruct->ruleID = 0; sts = EssPerformAllocationAso(hCtx, verifyOnly, &errorList, allocStruct); printf("EssPerformAllocationAso sts: %ld\n",sts); HandleErrors(hInst, &errorList); if(allocStruct) { sts = EssFree (hInst, allocStruct); printf("EssFree sts for allocStruct %ld\n",sts); } }