Problem with a dataport

I have a dataport exporting fields from the Employee table, I would like to include the Amount field from the Employee Rate table. I have defined Rate as a global variable and added it to the Dataport Fields. In the OnBeforeExportRecord trigger I have the following code: EmployeeRate.GET(“No.”,EmployeeRate.“Employee No.”); I get the following error: The Employee Rate does not exist. Identification fields and values: Employee No.=‘123’,Payroll Rate Code=’’,Effective Date=’’ I asssume I get the error because the primary key of the Employee Rate table is Employee No.,Payroll Rate Code,Effective Date. How do I modify the GET statement to include these fields?

Hi Steve, why don’t you try this: EmployeeRate.SETRANGE(“Employee No.”, “No.”); EmployeeRate.SETRANGE(“Payroll Rate Code”, payrollRateCode); EmployeeRate.SETRANGE(“Effective Date”, effectiveDate); IF EmployeeRate.FIND(’-’) THEN BEGIN //your code END; where: payrollRateCode and effectiveDate are the variables for filtering the relevant fields and you need to assign them with the desired values. But if you mad about using GET then you have just to include all the fields of the primary key i.e. EmpleyeeRate.GET(“No.”, payrollRateCode, effectiveDate); Good luck… :slight_smile:

Steve, in a GET statement you must include all filds in the primary key Example: EmployeeRate.GET(“No.”, payrollRateCode, effectiveDate); Pelle

Thanks for the response guys, I have defined payrollRateCode, effectiveDate as global varialbles, not sure what you mean when you say “you need to assign them with the desired values.” I used this line of code before the GET statement: PayrollRateCode := PayrollSetup.“Regular Pay Rate Code”; This Regular Pay Rate Code is set to ‘REGULAR’ which the the payroll rate code that I desire, but when I run the dataport I still get the same error.

maybe you should read Help about GET, then find out the primary key of EmployeeRate (3 fields), check the real records where the values come for these 3 fields…