Kindly check my method

hello friends

i want to make a report which will produce output of name (1 coloumn) and city(2 coloumn) of all the customers from CustTable…
but i dont want to give CustTable as a data source.
i want to fetch data using codes

so just check my code ,M i doing right?

  1. class declaration

CustTable custtable ; // creating a table buffer

str name;

str city;

2)execution section // method in body:sectiongroup

while select name,city from custtable
{
name = custtable.name
city = custtable.city

}

super();

  1. display method for name //body:section group method

display str name ()

{
return name;
}

  1. display method for city // body:section group method

display str city()
{
return city;
}

Hi pratham,

instead of writing your code in execute section (2), you can write that while select statement in fetch method.

sir …it means i m doing wrong …

right…?

or both methods will work…?

This code:

while select Name, City from custTable
{
     name = custTable.Name
     city = custTable.City

}

means that although you iterate through all customers, you always take name and city from the last one. That’s surely not what you wanted.

You only complicate your by not using table data source. Now you’ll have to execute the section explicitly for every customer, i.e. inside the while loop.

And please, use more appropriate thread names than “Kindly check my method”. Thanks.

Hi Pratham,

First of all, please be specific with the subject…

standard way of designing this report is by taking the custtable as datasource and

dragging the required fields to body… from the datasource…

Instead u can work on this by taking a programmable section and

declaring a custtable buffer as you have done and use the fetch method…

instead of using the execution section, use the fetch method…

since execution method will be called for every record…

so every time all the records are printed from the table… to the report…

thanks sir [:D]…

thanks sir Big Smile

could yo please give me an example of fetch method…?

Hi,

Just take a buffer of custtable… write the display methods as usual…

drag the display methods to programmable section…

public boolean fetch()
{
boolean ret;
;

while select custtable

{

     name = custTable.Name;
     city = custTable.City;
     this.execute(specify programmable section number);

}

ret = super();

return ret;

}

http://msdn.microsoft.com/en-us/library/bb395110.aspx

this might help you to understand about fetch method in reports…

Thank You for Giving Me Your Valuable Time… :slight_smile:

well i m a beginner i have average …i have average programming knowledge (c/c++/sql basics)… Could you please give me advice/tips regarding the programming side of Ax especially Ax reporting.?