Batch job D365

Hi,

Contact:

[DataContractAttribute,
SysOperationContractProcessingAttribute(classStr(CounterEntryOutliersUIBuilderClass))]
public class CounterEntryOutliersContract
{
Transdate startDate,endDate;
MROObjectCounterID objectCounterID;
MROObjectID objectId;

[DataMemberAttribute(‘Counter’),
SysOperationDisplayOrderAttribute(‘1’)]
public MROObjectCounterID parmCounter(MROObjectCounterID _objectCounterID = objectCounterID)
{
objectCounterID = _objectCounterID;
return objectCounterID;
}

[DataMemberAttribute(‘objectId’),
SysOperationDisplayOrderAttribute(‘2’)]
public MROObjectID parmObjectId(MROObjectID _objectId = objectId)
{
objectId = _objectId;
return objectId;
}

[DataMemberAttribute(‘StartDate’),
SysOperationDisplayOrderAttribute(‘3’)]
public StartDate parmStartDate(TransDate _startDate = startDate)
{
startDate = _startDate;
return startDate;
}

[DataMemberAttribute(‘EndDate’),
SysOperationDisplayOrderAttribute(‘4’)]
public EndDate parmEndDate(TransDate _endDate = endDate)
{
endDate = _endDate;
return endDate;
}

DP:

[
SRSReportQueryAttribute(queryStr(ObjectCounterQuery)),
SRSReportParameterAttribute(classStr(CounterEntryOutliersContract))
]
public class
CounterEntryOutliersDP extends SRSReportDataProviderBase
{

[SysEntryPointAttribute(false)]
public void processReport()
{
M

query = this.parmQuery();

contract = this.parmDataContract();

counterID = contract.parmCounter();
objectId = contract.parmObjectId();
startdate = contract.parmStartDate();
endDate = contract.parmEndDate();

startDateTime = DateTimeUtil::newDateTime(startdate,0);
endDateTime = DateTimeUtil::newDateTime(endDate,86400);

delete_from objectCounterTmp;
if(counterID)
{
select firstonly parmObjectCounter where parmObjectCounter.CounterID == counterID;
query.dataSourceTable(tablenum(ObjectCounter)).addRange(fieldnum(ObjectCounter,Counter)).value(queryValue(parmObjectCounter.RecId));
}
if(objectId)
{
select RecId from objectTable where objectTable.ObjectID == objectId;
query.dataSourceTable(tablenum(ObjectCounter)).addRange(fieldnum(ObjectCounter,Object)).value(queryValue(objectTable.RecId));// 5637178326));
}

query.dataSourceTable(tablenum(ObjectCounter)).addRange(fieldnum(ObjectCounter,CounterDateTime)).value(queryRange(startDateTime, endDateTime));

queryRun = new QueryRun(query);

ttsbegin;
while (queryRun.next())
{
this.insertTmpTable(mroObjectCounter);
}
ttsCommit;
}

private void insertTmpTable(MROObjectCounter objectCounter)
{
objectCounterTmp.insert();
}

[SRSReportDataSetAttribute(“ObjectCounterTmp”)] //tmp table
Public OObjectCounterTmp getObjectCounterTmp()
{
select * from objectCounterTmp;

return objectCounterTmp;
}

UIBuilder : 

class CounterEntryOutliersUIBuilderClass extends SysOperationAutomaticUIBuilder
{
CounterEntryOutliersContract contract;

DialogField dialogCounter;
DialogField dialogStartDate;
DialogField dialogEndDate;
DialogField dialogObjectId;

public void build()
{
Dialog dialogLocal = this.dialog();
contract = this.dataContractObject();
this.addDialogField(methodStr(CounterEntryOutliersContract,parmCounter), contract);
this.addDialogField(methodStr(CounterEntryOutliersContract,parmStartDate), contract);
this.addDialogField(methodStr(CounterEntryOutliersContract,parmEndDate), contract);
}

public void getFromDialog()
{
contract = this.dataContractObject();
super();
}

public void initializeFields()
{
contract = this.dataContractObject();
}

public void lookupCounter(FormStringControl _control)
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(ParmObjectCounter), _control);
;
sysTableLookup.addLookupfield(fieldnum(ParmObjectCounter, CounterID),true);

queryBuildDataSource = query.addDataSource(tablenum(ParmObjectCounter));

sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();
}

public void postBuild()
{
;
super();
dialogCounter = this.bindInfo().getDialogField(
this.dataContractObject(),
methodStr(CounterEntryOutliersContract,parmCounter));

dialogCounter.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(CounterEntryOutliersUIBuilderClass,lookupCounter),this);

dialogStartDate = this.bindInfo().getDialogField(
this.dataContractObject(),
methodStr(CounterEntryOutliersContract,parmStartDate));
dialogEndDate = this.bindInfo().getDialogField(
this.dataContractObject(),
methodStr(CounterEntryOutliersContract,parmEndDate));

}

public void postRun()
{
Dialog dialogLocal = this.dialog();
super();
// This method should be called in order to handle events on dialogs.
dialogLocal.dialogForm().formRun().controlMethodOverload(false);
}

}

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s