Company is not change while running the report

hii,

i created the processing only report and created the excel …

i want to get the data from all the companies…

i ceate two function for excel… first exceldataheader and put it on company’s on predataitem…and

second exceldatabody and put it on purchaseheader’s onaftergetrecord.

purchase header is indented under the company dataitem.

i use changecompany finction on Onpredataitems but it is not working…

what should i do?

it’s urjent…

could you supply some more information or even some code?

On which OnPreDataitem you have used the CHANGECOMPANY function ?

Hi, Why have you used company as a dataitem? Have you added the fields in DataItemLink property on Purchase Header table? I am not sure you will be able to provide DataItemLink to the system in Purchase Header DataItem.

You can do the following to achieve your desired output,

  • Remove all the dataitems from the report.
  • Declare Purchase Header and Company as record datatype global variables.
  • On the OnPreReport trigger, add this code,

Company.RESET;
IF Company.FINDSET THEN
REPEAT
PurchaseHeader.CHANGECOMPANY(Company.Name);
IF PurchaseHeader.FINDSET THEN
REPEAT
// code to send data to excel …
UNTIL PurchaseHeader.NEXT = 0;
UNTIL Company.NEXT = 0;

Hope this helps.