Displaying EmpName

Hi, I’m generating a report using HRMPayrollLine table,WrkCtrTable — std tables PSA_CostPerHr Table is the one which i created.In this table i have the fields WrkCtrGroupId,ValidFrom,AnnualCTC,CostPerHr(tis is a calculated field). Relations amoung these tables are HRMPayrollLine.emplId == EmplTable.EmplId WrkCtrTable.EmplId == HRMPayrollLine.emplId PSA_CostPerHr.WrkCtrGroupId == WrkCtrTable.WrkCtrGroupId How can i display the EmplId in my report. And i want to display the Difference in amount bwt PSA_CostPerHr.AnnualCTC and HRMPayrollLine.amount Where i consider only the AmountType = years. please can anybody help… Regards, Rajee

When you have emplId in HRMPayrollLine - there should not be any difficulty it putting that field in report.

If you want to have empl name use find method in emplTable.

you can write a select query by using the relation between them and you can calculate it.

Hi Kranthi, I got the EmpId in report But i’m not getting the difference in the amount.This is the code which i have written Display real VarianceAmt() { real a,b,Diff; int z; ; while select * from HRMPayrollLine index emplIdDateIdx where HRMPayrollLine.emplId == WrkCtrTable.EmplId { a = PSA_CostPerHr.AnnualCTC; b = HRMPayrollLine.amount; Diff = a - b; } return Diff; } can you please help me -Rajee

How will you get a record id into PSA_CostPerHr table buffer? you have not selected it any where.

and also there is no EMplId relation with the PSA_CostPerHr. Only you have WrkCtrGroupId relation between WrkCtrTable and PSA_CostPerHr . A WrkCtrGroupId can have multiple employees.

If that is not the case - you can write a select statement for PSA_CostPerHr table by using the relation between PSA_CostPerHr and WrkCtrTable.

Yes you are correct kranthi,a WrkCtrGroupId has many employees… so hw can i achieve the difference in cost?

yes kranthi you are right…WrkCtrGroupId has many employees…so hw can i achieve the difference in amount now?

Then you sholuld have EmplId field in PSA_CostPerHr table.

I cannot have the EmpId field in the PSA_CostPerHr table because i’m calculating the “CostPerHr” field in PSA_CostPerHr table irrespective of the employee selection. In the report when i select an employee say “1000”,i should display the ‘amount’ field in HRMPayrollLine table for that emp.And i should check the WrkCtrGroupId in which the emp is present and display the AnnualCTC in the PSA_CostPerHr table. and finally display the diff bwt the two fields mentioned here.

Then you wont get correct value - because you are saying that in a single WrkCtrGroupId there will be multiple employees.

So you should have one more relation between these two tables.

Ok,kindly suggest me if you have any ideas.

Display real VarianceAmt() { real a,b,Diff; ; while select * from HRMPayrollLine where HRMPayrollLine.emplId == WrkCtrTable.EmplId Join WrkCtrTable Where WrkCtrTable.WrkCtrGroupId == PSA_CostPerHr.WrkCtrGroupId && WrkCtrTable.IsGroup == Noyes::No { a = PSA_CostPerHr.AnnualCTC; b = HRMPayrollLine.amount; Diff = a - b; } return Diff; } Will this work?

it will not work because you have not selected the PSA_CostPerHr table

write one more select statement by using PSA_CostPerHr with in the while loop.

while select * from HRMPayrollLine where HRMPayrollLine.emplId == WrkCtrTable.EmplId Join WrkCtrTable Where WrkCtrTable.WrkCtrGroupId == PSA_CostPerHr.WrkCtrGroupId && WrkCtrTable.IsGroup == Noyes::No { a = PSA_CostPerHr.AnnualCTC; b = HRMPayrollLine.amount; Diff = a - b; } return Diff; I have written like this but still its not working, Any suggestions Kranthi?

Display HRMPayrollAmount Vari()
{

return PSA_CostPerHr_1.AnnualCTC - HRMPayrollLine_1.amount;
}

This method in the report helped me to dispaly the difference bwt the amts[:)].

-Rajee