--- In [EMAIL PROTECTED], "ax_ruetz"
<[EMAIL PROTECTED]> wrote:
> Hi Everybody,
>
> i am new to Axapta and have a simple question about reports. I want to
> make a report of the EmplTable. It should print a list of all
> employes. This is not a problem, it does what i want and is very easy.
>
> but my problem is that i want to count all employes and print the
> number of them at the end of the report. how can i do that?
>
> Michael

Hi Michael,

I had to solve a similar issue. I wanted to count purchlines 'overdue'
in eight different categories. I proceeded as follows:

1. added a 'few' lines in the Fetch-method of the report:
=============
public Boolean fetch()
{
    First = true;
    firstline = true;
    bSend = false;
    i=0 ; i1=0 ; i2 =0 ; i3=0 ; i4=0 ; i5=0; i6=0 ; i7=0 ; i8=0;
    queryRun = new QueryRun(this);

    while (queryRun.next()) // runs the query as set in the query-node
    {
        PurchTable = queryRun.get(tableNum(PurchTable));
        element.design().languageid(purchtable.LanguageId);
        intNoOfDays=0;        // days late
        if (purchTable.PurchStatus == PurchStatus::Backorder&&
            PurchTable.confirmedDlvDate < today())
        {
            if (PurchTable.confirmedDlvDate)
            {
                bSend=true;    //send purchtable-record:
                 
intNoOfDays=systemdateget()-purchtable.ConfirmedDlvDate ;
            }
            else
            {
                if (purchTable.DeliveryDate <today())
                {
                    bsend=true;
                     intNoOfDays=systemdateget()-purchtable.DeliveryDate ;
                }
            }
        }
        if (bSend)
        {
           if (oldPurchName != PurchTable.PurchName)
           {
               if (!first)
               {
                   element.design().languageid(purchtable.LanguageId);
                   //element.newPage();
               }
               else
               {
                   first = false;
               }
               oldPurchName = PurchTable.Purchname;
               element.send(PurchTable);
               firstline = true;
           }
           PurchLine = queryRun.get(tableNum(PurchLine));
           if (oldPurchOrder != PurchTable.PurchId)
           {
               if (!firstline)
               {
                   element.send(Purchtable);
               }
               else
               {
                   firstline = false;
               }
               oldPurchOrder= PurchTable.PurchId;
           }
           if(!purchline.ConfirmedDlv &&
                purchline.deliveryDate<systemdateget())
           {
              bSendLine=true;
              intNoOfDays=systemdateget()-purchline.DeliveryDate;
           }
           else
           {
                if(purchline.ConfirmedDlv<systemdateget())
                {
                    bSendLine=true;
                    intNoOfDays=systemdateget()-purchline.ConfirmedDlv;
                }
           }
           if(bSendLine) // if a purchline-record is to be send to the
report
           {

                switch (intNoOfDays div 7)
                {
                case 0 :  // up till 1 week  late
                   i++;   //sets counter in first category
                   break;
                case 1 :  // 1 - 2 weeks
                   i1++;
                   break;
                case 2 :  // 2 - 3 weeks
                   i2++;
                   break;
                case 3 :  // 3 - 4 weeks
                   i3++;
                   break;
                case 4 :  // 4 - 5 weeks
                   i4++;
                   break;
                case 5 :  // 5 - 6 weeks
                   i5++;
                   break;
                case 6 :  // 6 - 7 weeks
                   i6++;
                   break;
                case 7 :  // 7 - 8 weeks
                    i7++;
                    break;
                default :  // 8 weeks and longer
                    i8++;
                    break;
                }
            element.send(purchLine); // the purchline-record is send
to the report
           }

           bSendLine=false;
           bSend=false;
        }

   }

    return true;
}
===============

2. add a method to the section where i wanted the counters to be printed

===============

       display real RepStat_0()
       {
           return i;
       }
===============
3. and added a field which printed this method

Quite a lot of lines but it boils down to this, add a counter in the
Fetch which counts every record which is send to the report. Use a
method which enables the variable to be printed.

Hope to have been of help.

regards
Ted





Yahoo! Groups Links

Reply via email to