How to display name through methods

Hi all,

I have a small doubt regarding creation of a report. I created a new report and gave it a data source as VendTable table so it was displaying the name of vendor in that report. But if I try to do the same thing through methods i.e. using display method , it is not displaying the name of vendor in report.

What could be the reason for this. Please explain in detail.

Thanks in advance.

Which method and how you are using the method in the report?

if you want to write a display method to print a value in report, first you have to create a control to hold that value and in the properties of the control set DataMethod==MethodName(what you wrote). it means you are calling the method what you written from the control. the signature of the display method should be as follow.

display Name companyName()
{

;
return companyInfo::find().Name;
}

I have written a display method for displaying the name and address of vendor at report level.

So wenever i select a vendor, its name should be displayed in report but its not happening through this report level methods.

But wen i add Data Table and Data Field property for the control which i m using for displaying name and adress as VendTable and Name respectively, it is displaying the name and address

have you tried the way what i suggested.?

Yes i tried the way u suggested but it is working for displaying the company name, which wil remain the same for this report, but vendor name and address will change depending upon the selection of vendor account num which wil be given from front end.

I tried the same for the same way as u suggested for displaying vendor name address but its not displaying

Hi,

From what you mentioned, you have already set the report data source as VendTable. Not sure why you are trying to display method to display vendor name and address.

Can you explain the issue in detail? Also please post your code.

Hi Karn,

if you want in the display method, you have to write in the below passion.

display VendName NameofVendor()
{ ;
return vendTable::find(AccountNum).Name;
}

Thanks,

Valeru.

Hi,

I am also facing the same problem for this dispaly methods. I have to display customer name and address and Transdate in report . So I added the CustTable as a datasource in report and added the string in report gven the tabel and data field .so it is displaying the customer name and address in report.but when ever i tried without using the datasource (CustTable) in report , i tried through dispaly method. But the data is not fetching in report.

I added the code like dis for

customer name :

display name customerName()
{
str ret, title1, title2;
;
ret = custTable::find(schregularDeposits.SCHDepositorNo).Name;
title1 = substr(ret, 1, 3);
title2 = substr(ret, 1, 4);
if ((title1 == ‘Mr.’)||(title2 == ‘Mrs.’))
return ret;
else
return strfmt(’%1 %2’, custTable::find(schRegularDeposits.SCHDepositorNo).SCHTitle,
ret);
}

CustAddress:-

display addressing custAddr()
{
return custTable::find(schregularDeposits.SCHDepositorNo).Address;
}

Have you tried by debugging the code, were you able to get the schregularDeposits table record???(try to avoid multiple returns rather use a variable and return it finally)

Hi,

I didnt tried by Debbugging the code . Actually the same methods are using in another report for displaying the customer name and address and executing that pgmmble sections in fetch method. So i added these methods in section group header in report.

Hi Karn,

If u drag and drop the table(VendTable) directly to your reports dataSource ,then the dasource name will be as VendTable_1. The report runs on VendTable_1 basis instead of VendTable. So check the datasource name of ur report and try to pick that value on the basis of VendTable_1.AccountNum as valeru mentioned above

Try to debug the code, to know what exactly happening with the method…

Hai

I got the solution for that display methods, at last i come 2 know that whenever we added the CustTable as datasource and CustTable section then we can gve the datafield and table name (we cant write through dispaly methods). suppose if it is in another section eg: SCH regular deposit section we can add thru display methods . and these things have to fetch in report(front end) means we have to write query in fetch method .