Category: SSRS Ax 2012

Report printing Extra page

Hi, If report printing extra page please check below logic.

Body Width <= Page Width – (Left Margin + Right Margin)

Horizontal usable area:

X = Page.Width – (Left Margin + Right Margin + Column Spacing)

Vertical usable area:

Y = Page.Height – (Top Margin + Bottom Margin + Header Height + Footer Height)

Any time objects on your report (including the Body itself) extend past the usable area either because they are defined like that or because they grow at runtime, the physical page renderers have no choice but to break onto a new page.

Filtering data in SSRS Query

Hi,

Below is the sample code written to filter the data based on Query used by report and apply on custom query in DP class;

//DP class

queryVendInvoiceJour=this.parmQuery();

//Get filtered/selected value from standard query 
qrOrderAccount = queryVendInvoiceJour.dataSourceName(‘VendInvoiceJour’).rangeField(fieldNum(VendInvoiceJour,OrderAccount));

//Writing custom query based on requirement but applying the selected ranges to custom query

q=new Query();
qbdsVendInvoiceJour = q.addDataSource(tablenum(VendTrans));
qrVendInvoiceJour = qbdsVendInvoiceJour.addRange(fieldNum(VendTrans,AccountNum));
q.dataSourceNo(1).rangeField(fieldNum(VendTrans,AccountNum)).value(qrOrderAccount.value());

qr = new QueryRun(q);

 

This will help to overwrite the Query used in Report using the custom query by applying same ranges selected by user.

HAPPY DAXing 🙂

SSRS : Contract Class & Debug it

Hi,

Below is the sample code to Develop the contract class.

Here I need to pass the “Date” as the parameter, based on the selected data I need to get the data.

1) [DataContractAttribute]

class SrsRDPContractIndemnity

{

StartDate        tillDate;

}

2)  [DataMemberAttribute(“Date”)]

public StartDate asOfDate(StartDate _tilldate = today())

{

tillDate = _tilldate;

return tillDate;

}

Debug the contact class: 

static void SSRS_ContractclsDEBUG(Args _args)

{

ProdRouteTrans  prodRouteTrans;

//ACWAPIPETotalItemProdPerMonthTmp  acwaPIPETotalItemProdPerMonthTmp;

MZK_PayrollIndemnityTmp payrollIndemnityTmp;

IndemnityRDP dataprovider = new IndemnityRDP();

SrsRDPContractIndemnity    contract    = new SrsRDPContractIndemnity();

;

contract.asOfDate(today());

dataProvider.parmDataContract(contract);

dataProvider.processReport();

payrollIndemnityTmp = dataProvider.getDate();

}

SSRS : RDP class & Debug it

HI,

Below is the sample code for developing RDP class for SSRS reports

[SRSReportQueryAttribute (querystr(HcmWorkerListPage_Perment)), //My Query

SRSReportParameterAttribute(classStr(SrsRDPContractIndemnity))] //class name

1) class IndemnityRDP extends SRSReportDataProviderBase

{

MZK_PayrollIndemnityTmp        tmpPayrollIndemnity;

Mzk_PayrollIndemnityonly       payrollIndemnityonlycls;

}

2)

[SRSReportDataSetAttribute(“MZK_PayrollIndemnityTmp”)] //tmp table

Public MZK_PayrollIndemnityTmp getDate()

{

select * from tmpPayrollIndemnity;

return tmpPayrollIndemnity;

}

3)

[SysEntryPointAttribute(false)]

public void processReport()

{

QueryRun                    queryRun;

Query                       query;

    SrsRdpContractIndemnity  dataContract;

QueryBuildRange             qbrHcmWorker;

QueryBuildRange             qbrJourTrans;

StartDate                   tillDate;

QueryBuildDataSource          qbsHcmworker;

HcmWorker                   getHcmworker;

// Get the query from the runtime using a dynamic query.

query = this.parmQuery();

// Get the parameters passed from runtime.

dataContract    = this.parmDataContract();

tillDate = dataContract.asOfDate();

// Add parameters to the query.

qbsHcmworker = query.dataSourceTable(tablenum(HcmWorker));

if(tillDate)

{

qbrHcmWorker = qbsHcmworker.findRange(fieldnum(HcmWorker, NewHcmEmployeeType));

// If an invent JournalId has not been set, then use the parameter value to set it.

if(!qbrHcmWorker.value())

qbrHcmWorker.value(int2str(any2int(MZK_EmployeeType::Permanent)));

}

// Run the query with modified ranges.

queryRun    = new QueryRun(query);

ttsbegin;

while (queryRun.next())

{

getHcmworker = queryRun.get(tableNum(HcmWorker));

this.insertTmpTable(getHcmworker, tillDate);

}

ttsCommit;

}

4)

private void insertTmpTable(HcmWorker _hcmWorker,

StartDate  _tilldate=today())

{

HcmPayrollLine      hcmPayrollLline;

HcmEmployment       hcmEmployment;

utcDateTime         joinDateTime;

date                joinDate;

 

payrollIndemnityonlycls = new Mzk_PayrollIndemnityonly();

tmpPayrollIndemnity.Worker                  =   _hcmWorker.RecId;

tmpPayrollIndemnity.NewHcmEmployeeType      =   _hcmWorker.NewHcmEmployeeType;

tmpPayrollIndemnity.CitizenshipCountryRegion=   _hcmWorker.Nationality();

tmpPayrollIndemnity.Joindate                =   _hcmWorker.Joindate();

tmpPayrollIndemnity.Tilldate                =   _tilldate;

tmpPayrollIndemnity.Name                    =   _hcmWorker.name();

tmpPayrollIndemnity.Service                 =   (_tilldate – tmpPayrollIndemnity.Joindate)/365;

joinDateTime = DateTimeUtil::applyTimeZoneOffset(    hcmEmployment::findByWorker(_hcmWorker.RecId).ValidFrom, DateTimeUtil::getUserPreferredTimeZone());

joindate = any2date(joinDateTime);

tmpPayrollIndemnity.Indemnity   =   payrollIndemnityonlycls.payrollGeneration(_hcmWorker.RecId,joindate,_tilldate);

tmpPayrollIndemnity.insert();

}

Debug code for RDP:

static void SSRS_RDPclsDEBUG(Args _args)

{

//MachineBreakDownSlipTmp ACWATransferhistoryTmp;

MZK_PayrollIndemnityTmp payrollIndemnityTmp;

IndemnityRDP dataprovider = new IndemnityRDP();

//MachineBreakDownSlip_queryDP dataprovider = new MachineBreakDownSlip_queryDP();

dataProvider.processReport();

payrollIndemnityTmp = dataProvider.getDate();

}