Assigning null value to fields in report ax 2009

I have created a Report based on Sales order in which depending on Document status the fields : pickingQty , packingQty, confirmedQty, invoicedQty, outstandingQty should be set to 0 ( showzero is set to no). But i am not able to set my fields to null following is the code that i wrote in my fetch() in report but still i am getting the exact values instead of getting null values. I don’t understand what is wrong in my code. Any help would be appreciated thanks in advance

public boolean fetch()

{

QueryBuildDataSource qbds;

Query q ;

queryRun qr;

DocumentStatus documentStatus;

;

q = this.query();

qbds = q.dataSourceTable(tablenum(SalesLine));

qbds.addRange(Fieldnum(SalesLine,CreatedDateTime)).value(queryRange(FromDate,ToDate));

qr = new queryRun(q);

while(qr.next())

{

salesLine = qr.get(Tablenum(SalesLine));

this.send(SalesLine);

documentStatus = SalesLine.salesTable().DocumentStatus;

quotationQty = (Select qty from custConfirmTrans

where custConfirmTrans.SalesId == salesLine.SalesId

&& custConfirmTrans.ItemId == salesLine.ItemId).Qty;

if(documentStatus == DocumentStatus::Confirmation)

{

confirmQty = (Select qty from custConfirmTrans

where custConfirmTrans.SalesId == salesLine.SalesId

&& custConfirmTrans.ItemId == SalesLine.ItemId

&& custConfirmTrans.InventTransId == SalesLine.InventTransId).Qty;

pickingQty = 0;

packingQty = 0;

invoiceQty = 0;

outstandingQty = 0;

}

else if(documentStatus == DocumentStatus::Invoice)

{

invoiceQty = SalesLine.invoicedInTotal();

pickingQty = 0;

packingQty = 0;

ConfirmQty = 0;

outstandingQty = 0;

}

else if(documentStatus == DocumentStatus::PickingList)

{

pickingQty = (Select qty from WMSOrderTrans

where WMSOrderTrans.itemId == SalesLine.ItemId).qty;

ConfirmQty = 0;

packingQty = 0;

invoiceQty = 0;

outstandingQty = 0;

}

else if(documentStatus == DocumentStatus::PackingSlip)

{

packingQty = SalesLine.deliveredInTotal();

pickingQty = 0;

ConfirmQty = 0;

invoiceQty = 0;

outstandingQty = 0;

}

else if (documentStatus == DocumentStatus::None)

{

packingQty = 0;

pickingQty = 0;

ConfirmQty = 0;

invoiceQty = 0;

outstandingQty = 0;

}

}

return true;

}

Why is my quantity not setting to null ?

5241.AxOutstandingReport.png

Are you not able to find that by debugging your code?

i placed the debugger as you can see in the image , the value assigned should be 0 as coded but it shows value 7 in it.

At which point the debugger showing the value in 7 instead of 0.

I suspect either the statement Packing qty = 0 is not executing or you are checking the value before the execution of the statement.

when the debugger is at the statement Picked qty = 0 i.e after execution of Packing qty = 0.

you may observe Packing qty = 0;