display methods in classes

Hai friends

I have a display method in table, some thing like below:

display int calulationOfOT()

{

return this.a + this.b;

}

can i use this display method inside of my class in some code.

Thanks in advance.

Hi Chakradhar,

You can use your table display method in class , just make buffer of that table and use it just like this,

YourTable yourTable;

;

yourTable.abc;

hai rajKumar, thanks for ur reply.

i created a display method in table with out parameters and used in multiple forms.

This display method has some code.

My problem is i want to pass some particular record in to the display method and return the result.But my display method has no parameters created.

We can create parameters in display method but i dont want to do this as i used this display method in multiple forms.

we can access the display method as u said above but how can we pass the record inside the display method.

please reply if dont understand the question.

let me explain u clearly in base code

we have a display method named customerName in sales table as below

display CustName customerName()
{
return this.custTable_CustAccount().Name;
}

if i want to get the customer name of 1101 in the class of some code.

How can i get it with out passing parameter.

But why to pass the buffer as a parameter? Instead of something like MyTable::calculationOfOT(myTableBuffer), you can simply call myTableBuffer.calculationOfOT().

If you need some additional processing (which is not shown in your example), simply extract the content of calculationOfOT() to a separate method (with a parameter or anything you need) and call it from both places (your class and the display method).

If you already have CustId, why would you call anything on SalesTable? The only thing you need is CustTable::find(“1101”).Name.

hai martin

yes we can create other method and pass parameter and get the result. But i have same code in display method which can be reused.

a small example

In class:

while select KMCompensaction // first table name : KMCompensaction

{

result += kMDeduction**.calcOt();** // here kMDeduction is second table name and CalcOt is

//the display method and i want to pass parameter of first table record into display method and do calculation

}

Hi,

As martin suggest, you should write the calcOt() method in KMCompensaction table as well.

Then you can get the desired result.

Hope it helps.

dear martin and ashley thanks for ur replys.I have done what u said.