get custName on custNum in forms field

My form’s datasourse is LedgerTrans table which contains AccounyNum. AccountName is in LedgerTable.In LedgerTable one AccountName is associated with the each AccountNum in LedgerTrans. (sorry for my earlier post where i mention that there is many AccountName for each AccountNum).

My problem is i hav to show AccountName in my form for rach AccountNum.I hav write the following lines of code to get accountName.

display AccountName retAccName()

{

select AccountName from LedgerTable where LedgerTable.AccountNum == LedgerTrans.AccountNum;

retaccName = LedgerTable.AccountName;

return retaccName;

}

I tried this name in datasourse’s methods and created a field in grid using that method by darg-droping in to grid.Here i get the only AccountName for first line that is for first AccountNum . n it keeps repeating for other accountNum’s.

Pleaes tel me where shld i write this function.On wich method i shld i write to get accountName for each accountNum.

Regards

Ganesh Sahane

HI ganesh ,

in ledgertrans table methods we have one method called account name,u just drag that method in to the form design after the accountnum,thats it.it will come automatically.

other wise u write code like this

//BP Deviation Documented
display AccountName accountName()
{
return LedgerTable::find(this.AccountNum).AccountName;
}

Hi Ganesh,

Pass the datasource name as a parameter to the display method.

display AccountName retAccName(LedgerTrans _ledgerTrans)

{

select AccountName from LedgerTable where LedgerTable.AccountNum == _ledgerTrans.AccountNum;

retaccName = LedgerTable.AccountName;

return retaccName;

}

better use find instead of select.

Ambanna Yatnal

Hi Naresh

Thanks for replaying :).I tried this earlier but not giving me the expected result. Also there was another field calld crossPartyName which i hav to tak it from another 4 tables depend upon the crossParty from LedgerTrans.So i solve this by using Temp table.

Thanks Again for replaying me. :slight_smile:

Regards

Ganesh Sahane

Hi Ambanna

Thanks for replaying :).

Dude It is working properly as i want with ur solution.

There was another field calld crossPartyName which i hav to tak it from another 4 tables depend upon the crossParty from LedgerTrans.So i solve this by using Temp table & also working good by taking datasourse as a parameter. Now i have 2 ways to solve the problem.

Thanks Again for replaying me. :slight_smile:

Regards

Ganesh Sahane