Tuesday, December 27, 2011

SysInfolog Enumurator


infologData infologData;
SysInfologEnumerator sysInfologEnumerator;
;
Warning("This is to test warning");
Error("This is to test Error");
infologData = infolog.infologData();
sysInfologEnumerator = SysInfologEnumerator::newData(infoLogData);

// loop the enumerator and jump from loop when an error has been found
while (sysInfologEnumerator.moveNext())
{
if(sysInfologEnumerator.currentException() == Exception::Error)
{
messageText = strrtrim(strltrim(sysInfologEnumerator.currentMessage()));
messageText = substr(messageText,3,strlen(messageText));
}if(sysInfologEnumerator.currentException() == Exception::Warning)
{
messageText = strrtrim(strltrim(sysInfologEnumerator.currentMessage()));
messageText = substr(messageText,3,strlen(messageText));
}

}

Monday, February 7, 2011

Query: Using groupby and order by when using sum()

Using groupby and order by when using sum()

Select sum(qtyOrdered) from SalesLine order by SalesLine.LineNum Desc group by salesLine.LineNum, salesLine.CustAccount

Note: the order of columns in "Order By" should be same as in "Group By" else it will not work.

In case of query, the addsortfield should be done before adding the addGroupByField fields
ds.ordermode(OrderMode:GroupBy) should not be used (using this will prevent the OrderBy from working but there is a draw back. The grid sorting will not work)


Datasource-> init() method

QueryBuildDataSource OperationsDs;

;

OperationsDs = this.query().dataSourceTable(tablenum(CAP_OperationsList));

OperationsDs.addSortField(fieldNum(CAP_OperationsList, CAP_ProfileReferenceGroupId),sortOrder::Ascending);

OperationsDs.addSortField(fieldNum(CAP_OperationsList, CAP_CutLength),sortOrder::Descending);

OperationsDs.addGroupByField(fieldnum(CAP_OperationsList, CAP_ProfileReferenceGroupId));

OperationsDs.addGroupByField(fieldnum(CAP_OperationsList, CutGroupId));

//OperationsDs.orderMode(OrderMode::GroupBy);

RePrint column headings in report

SalesQuotation report -> checkPrintLineHeader()
element.executeBodyColumnHeadings(tablenum(CustQuotationTrans));

Disable a footer section in report

if (element.page() != 1)
{
    element.disableSection(totals);
    element.disableSection(CAP_SalesResp);
}

Friday, January 14, 2011

How to convert TransDate to UTCDateTime.

Class SalesParmCleanUp()->deleteSalesParmTables method:
    TransDate cleanupDate;
    UtcDateTime cleanUpDateTime;
    ;

    cleanUpDateTime = datetoendUtcDateTime(cleanupDate,
                                           DateTimeUtil::getUserPreferredTimeZone());