I want to show NBV from AmountCur to each month field

public void ProcessReport()

AssetTrans assettrans;
AssetGroup assetgroup;
AssetTable assettable;
AssetBook assetbook;
AssetSumCalc_Trans assetsumcalc;
StartDate startdate, startdate1;
EndDate enddate, enddate1;

TransDate periode;

AssetListFixedActiveContract contract= this.parmDataContract();

periode = contract.parmperiode();
startdate = mkDate(1, mthOfYr(periode), year(periode));
startdate1 = mkDate(1, 1, year(periode));
enddate = endmth(periode);

if (periode == dateNull())
periode = systemDateGet();

while select assetgroup

while select sum(AmountCur) from assettrans where assettrans.AmountCur
&& assettrans.AssetGroup == assetgroup.GroupId
&& assettrans.TransType == AssetTransType::Depreciation
&& assettrans.TransDate >= startdate1

tmp.JanuaryNBVBalance = assettrans.AmountCur;
tmp.FebruaryNBVBalance = assettrans.AmountCur;
tmp.MarchNBVBalance = assettrans.AmountCur;
tmp.AprilNBVBalance = assettrans.AmountCur;
tmp.MayNBVBalance = assettrans.AmountCur;
tmp.JuneNBVBalance = assettrans.AmountCur;
tmp.JulyNBVBalance = assettrans.AmountCur;
tmp.AugustusNBVBalance = assettrans.AmountCur;
tmp.SeptemberNBVBalance = assettrans.AmountCur;
tmp.OctoberNBVBalance = assettrans.AmountCur;
tmp.NovemberNBVBalance = assettrans.AmountCur;
tmp.DecemberNBVBalance = assettrans.AmountCur;
enddate1 = endmth(enddate+1);

while (enddate1 <= enddate);
enddate1 = endmth(startdate1);



Could you please explain your problem? Just showing a piece of code doesn’t really explain what kind of advice you need from us. What are you trying to achieve and what problem do you have with it?

i have a report to show amountcur and would show in 12 month
in this report i use do while condition
and some piece a query to declare variable
please help me to resolve this report thanks

& i have incorrect query, i hope someone can help my problem, thanks

I don’t understand what you meant by your code. For example, why are you always putting the amount to all months, instead of the currently processed month. Or what’s the point of “while select assetgroup” if you don’t have any filtering there?

If I was you, I would create a view with a computed column representing the month and then I would simply combine sum(AmountCur) with grouping by month.