Re: [Axapta-Knowledge-Village] Help Understanding Queryrun.changed Method

2010-01-12 Thread Jonathan Halland
Hi

Query Run.changed should let you know whether that table in question has
switched over to a new record when the queryRun.next() call was made. E.g if
you have a PurchTable linked to multiple PurchLines in a query, the line
will change everytime the next() is called but the PurchTable will only
change after you have read through all the lines.

Rgds
Jonathan

On Mon, Jan 11, 2010 at 5:26 PM, Salu J  wrote:

>
>
> Hello All,
>
> I am new to Axapta and I am trying to understand the QueryRun.changed
> method. I have pasted an example of code below. There is Query
> CusttransCustSettlement that essentials joins the custtrans and the
> custsettlement tables. In the code below there is a
> if(queryRun.changed(tablenum(CustSettlement))) statement. I am not sure what
> that means? does it mean if the table was updated while the code was
> executed? or does it mean if the record has changed? I would appreciate some
> input with an example.
>
> Thank You in Advance
> Salu Joseph
>
> while (queryRun.next())
> {
> custTrans = queryRun.get(tablenum(CustTrans));
> if (!optimizeUsingSumQuery)
> {
>
> if (!custTransRecIdSet.in(custTrans.RecId))
> {
> custTransRecIdSet.add(custTrans.RecId);
> //balanceAge[1] += custTrans.remainAmountMST();
> balanceAge[1] += custTrans.remainAmountCur(); // SP6 needed this Pankaj
> change
> }
> }
> if(queryRun.changed(tablenum(CustSettlement)))
> {
> custSettlement = queryRun.get(tablenum(CustSettlement));
>
> balanceAge[1] += custSettlement.SettleAmountMST;
> balanceAge[1] += custSettlement.ExchAdjustment;
>
> for (numOfAge = 2; numOfAge <= dimof(balanceAge); numOfAge++)
> {
> startDate = startDateArray[numOfAge];
> endDate = endDateArray[numOfAge];
> if (!custSettlement.DueDate)
> {
> custSettlement.DueDate =
> CustTransOpen::findRefId(custSettlement.TransRecId).DueDate;
> }
>
> if(this.dateOkSettlement(custSettlement, startDate, endDate))
> {
> tmpAccountSum.AccountNum = _custTable.AccountNum;
> this.placeTransInColumns(custTrans, custSettlement.SettleAmountMST -
> custSettlement.ExchAdjustment, numOfAge, custSettlement.DueDate);
> break;
> }
> }
> }
> }
>
>  
>


[Axapta-Knowledge-Village] Help Understanding Queryrun.changed Method

2010-01-11 Thread Salu J
Hello All,

I am new to Axapta and I am trying to understand the QueryRun.changed method. I 
have pasted an example of code below. There is Query CusttransCustSettlement 
that essentials joins the custtrans and the custsettlement tables. In the code 
below there is a if(queryRun.changed(tablenum(CustSettlement))) statement. I am 
not sure what that means? does it mean if the table was updated while the code 
was executed? or does it mean if the record has changed? I would appreciate 
some input with an example.

Thank You in Advance
Salu Joseph

   while (queryRun.next())
{
custTrans = queryRun.get(tablenum(CustTrans));
if (!optimizeUsingSumQuery)
{

if (!custTransRecIdSet.in(custTrans.RecId))
{
custTransRecIdSet.add(custTrans.RecId);
//balanceAge[1] += custTrans.remainAmountMST();
balanceAge[1] += custTrans.remainAmountCur();   // SP6 needed 
this Pankaj change
}
}
if(queryRun.changed(tablenum(CustSettlement)))
{
custSettlement = queryRun.get(tablenum(CustSettlement));

balanceAge[1]   += custSettlement.SettleAmountMST;
balanceAge[1]   += custSettlement.ExchAdjustment;

for (numOfAge = 2; numOfAge <= dimof(balanceAge); numOfAge++)
{
startDate = startDateArray[numOfAge];
endDate   = endDateArray[numOfAge];
if (!custSettlement.DueDate)
{
custSettlement.DueDate = 
CustTransOpen::findRefId(custSettlement.TransRecId).DueDate;
}

if(this.dateOkSettlement(custSettlement, startDate, endDate))
{
tmpAccountSum.AccountNum = _custTable.AccountNum;
this.placeTransInColumns(custTrans, 
custSettlement.SettleAmountMST - custSettlement.ExchAdjustment, numOfAge, 
custSettlement.DueDate);
break;
}
}
}
}