EssListTransactions

Returns transaction messages to a client buffer or to a comma-separated file. You can export comma-separated files to relational databases for processing with third-party tools.

Syntax

ESS_FUNC_M EssListTransactions(hCtx, TimeSrc, InpTime, 
			ListOption, FileName, pCount, ppResults);
ParameterData TypeDescription

hCtx

ESS_HCTX_T

Login context must be set active before calling this API.

TimeSrc

ESS_USHORT_T

The option that specifies where to get the start time for display transactions.

InpTime

ESS_TIME32_T

Input the time if TimeSrc is ESS_TRLOG_TIMESPECIFIED.The time is a ULONG representing the number of seconds since January 1, 1970.

ListOption

ESS_USHORT_T

The option that specifies the destination of the output. See List Option Constants (C)

FileName

ESS_STR_T

If ListOption is either of the LIST_TRANSACTIONS_* options, then the content is written to this file on the server machine:

  • You can enter a full path.

  • Default:

    $ARBORPATH/app

pCount

ESS_PULONG_T

Number of entries returned

ppResults

ESS_PPTRANSACTION_ENTRY_T

The entries returned if ListOption is ESS_LIST_TRANSACTIONS_TOCLIENT

Return Value

Access

You must have an active database using set active before calling list transactions.

The caller must have Essbase Administrator access to the database.

Example

void ListAndReplayTransactions()
{
	ESS_FUNC_M				sts = ESS_STS_NOERR;
	ESS_USHORT_T				TimeSrc;
	ESS_TIME32_T				timestamp = 0;
	ESS_USHORT_T				listOption;
	ESS_STR_T					FileName = ESS_NULL;
	ESS_ULONG_T				Count = 0;
	ESS_PTRANSACTION_ENTRY_T	pResults;
	ESS_CHAR_T				listTime[ESS_TIMESIZE];
	ESS_TRANSACTION_REPLAY_INP_T	ReplayInp;
	ESS_PSEQID_T				pSeqIds = ESS_NULL;
	ESS_OBJDEF_T				Data;
	ESS_STR_T					Script;
	ESS_SHORT_T				isAbortOnError;
	ESS_PMBRERR_T			pMbrErr = NULL;
	ESS_PROCSTATE_T		pState;

	/* Load data from server */
	Data.hCtx      = hCtx;
	Data.AppName   = AppName;
	Data.DbName    = DbName;
	Data.ObjType   = ESS_OBJTYPE_TEXT;
	Data.FileName  = "Calcdat";
	isAbortOnError = ESS_TRUE;
	sts = EssImport (hCtx, ESS_NULL, &Data, 
								&pMbrErr, NULL, isAbortOnError);
	printf("EssImport sts: %ld\r\n",sts);

	/* List and replay with a specified time */
	TimeSrc = 1;
	strcpy(listTime, "09/18/2007:00:00:00");  
							/* mm/dd/yyyy:hh:mm:ss */
	timestamp = adtGenericGetTime(listTime);
	listOption = ESS_LIST_TRANSACTIONS_TOCLIENT;
	sts = EssListTransactions(hCtx, TimeSrc, 
												timestamp, listOption, 
												FileName, &Count, &pResults);
	
		/* This function converts listTime to the number of 
			seconds since January 1, 1970. */

	printf("EssListTransactions sts: %ld\r\n",sts);
	if (Count && pResults)
		PrintTransactionLog(Count, pResults);

	memset(&ReplayInp, 0, sizeof 
								(ESS_TRANSACTION_REPLAY_INP_T));
	ReplayInp.InpType = ESS_REPLAY_BASED_GIVENTIME;
	ReplayInp.value.InpTime = timestamp;
	sts = EssReplayTransactions (hCtx, AppName, DbName, 
													ReplayInp, pSeqIds);
	printf("EssReplayTransactions sts: %ld\r\n",sts);
	printf("\n\n");

	/* Run a calc*/
	Script = "CALC ALL;";
	sts = EssCalc(hCtx, ESS_TRUE, Script);
	printf("EssCalc sts: %ld\r\n",sts);
	if (!sts)
	{
		sts = EssGetProcessState (hCtx, &pState);
		while (!sts && (pState.State != ESS_STATE_DONE))
			sts = EssGetProcessState (hCtx, &pState);
	}

	/* List and replay with last replay time */
	TimeSrc = 2;
	timestamp = 0;
	sts = EssListTransactions(hCtx, TimeSrc, 
											timestamp, listOption, 
											FileName, &Count, &pResults);

		/* This function converts listTime to the number of 
			seconds since January 1, 1970. */
	printf("EssListTransactions sts: %ld\r\n",sts);
	if (Count && pResults)
		PrintTransactionLog(Count, pResults);
	memset(&ReplayInp, 0, sizeof 
							(ESS_TRANSACTION_REPLAY_INP_T));
	ReplayInp.InpType = ESS_REPLAY_BASED_LASTREPLAYTIME;
	sts = EssReplayTransactions (hCtx, AppName, 
						DbName, ReplayInp, pSeqIds);
	printf("EssReplayTransactions sts: %ld\r\n",sts);

	if(pSeqIds)
		EssFree(hInst, pSeqIds);
	if(pResults)
		EssFree(hInst, pResults);
	if(pMbrErr)
		EssFree(hInst, pMbrErr);
}

See Also