Skip to main content
Solved

Pulling data from PREmployeeAttribute in a GI


Forum|alt.badge.img

Hello. I’m trying to create a Generic Inquiry that pulls information from the PREmployeeAttribute screen which resides under Employee Payroll Settings > Tax Settings.

I have the GI created and linked with the PREmployeeAttribute table but I’m not sure how to specify which ROW and COLUMN that GI pulls.

For example - when I choose Object: PREmployeeAttribute > Data Field: value it will return the social security number. I’m guessing because that’s the first value on the table. But I want to add another column / row in the GI that pulls the ‘value’ from the Ethnicity row.

 

Best answer by aaghaei

Hi @brandontfrank 

There is no straight answer to your question, and you will not find all of the attributes in the out-of-the-box DAD definition. There are two general considerations. I believe I had provided a thorough explanation on a different topic related to the attributes but I can’t find it so I will try to explain to the best of my knowledge. Others might have a better solution:

  1. You will need to join your “EPEmployee” DAC to the GROUP OF ATTRIBUTE tables equal to the number of attributes that you want to retrieve. The reason is the attributes do not live in the associate record table. The attributes have their own dedicated table and are stored in rows and not in columns.
  2. Depending on the type of attributes that you are trying to retrieve, your approach will be different. The easiest retrieval will be string attributes and the most difficult one is the selector type attributes.

The GROUP OF ATTRIBUTE tables (this is what I call them not an official name) are:

CSAttribute : Stores the Attributes and its key field is AttributeID. For Example, if you create an attributed of list type to have dropdown values and call it “EC” and “Eye Color” it will be stored in this table.

CSAttributeDetail: Stores the predefined values of the Attributes. It stores all predefined values other than “Text” and “Selector”. Its key fields are AttributeID and ValueID. If in our above example you enter “BK” “Black”, “BR” “Brown and “BL” “Blue” they will be stoted in this table.

Now Acumatica platform needs to know what master entities (i.e. Employees, Projects, ...) can use which one of these Attributes. When in the Employee Preferences (note that some of these links may be configured behind the scenes and you do not see it) we say Employee record can use Attribute “EC” the platform stores the link between the Attribute and the Employee entity in the CSAttributeGroup table. Its key fields are AttributeID, EntityClassID and EntityType. The EntityType for Employees will be stored as “PX.Objects.EP.EPEmployee” if we need to filter on it. Most probably you will not need this table in your joins.

Now that the platform knows each entity what kind of Attributes can have, we can proceed with assigning the Attributes Values to each individual master record. This mapping stored in CSAnswers and its key fields are RefNoteID and AttributeID. The AttributeID abviously will need to be joind with CSAttribute but the RefNoteID is the NoteID of the master record we are trying to assign an attribute to it. For example, in Employee case the LEFT (because some employees may do not have attribute and still, we want them in the report) JOIN is EpEmployee.NoteID = CSAnswers.RefNoteID.

The value you want to show in your inquiry for string fields is CSAnswers.Value. Assuming all your values are string field, you will need to repeat this process for each attribute. For dropdown and selector it is a little bit more complicated. for example for selector still you will need to get the CSAnswers.Value from here, depending on the primary key of selector table join with that table and return the desired value from that table. For dropdown, you wiull need to join the CSAnswers.Value = CSAttributeDetail.ValueID and return the CSAttributeDetail.Description.

to add an example let say we have another attribute called “SX” “Sex” that has a dropdown value of “W” “Woman”, “M’ “Man” and “X” “Unknown”

 

I am writing my query in SQL format but you can easily translate to GI

 

SELECT

EMP.EmployeeCD, ANS1.Value, ATD2.Description

FROM

EPEmployee EMP

LEFT JOIN CSAnswers ANS1 ON EMP.NoteID = ANS1.RefNoteID

LEFT JOIN CSAttribute ATR1 ON ANS1.AttributeID = ATR1.AttributeID AND ATR1.AttributeID = ‘EC’

LEFT JOIN CSAnswers ANS2 ON EMP.NoteID = ANS2.RefNoteID

LEFT JOIN CSAttributeDetail ATD2 ON ANS2.AttributeID = ATD2.AttributeID AND ANS2.Value = ATD2.ValueID AND ATD2.AttributeID = ‘SX’

View original
Did this topic help you find an answer to your question?

Forum|alt.badge.img+8
  • Semi-Pro I
  • October 19, 2023

Hi @brandontfrank Please verify if the Generic Inquiry → result grid shows the Attribute Column. Please provide us a screenshot of the GI.


Forum|alt.badge.img
ChandraM wrote:

Hi @brandontfrank Please verify if the Generic Inquiry → result grid shows the Attribute Column. Please provide us a screenshot of the GI.

Sory- I don’t know exactly what you’re asking for…

Attribute column for what? The PREmployeeAttribute options are very limited and if that’s what you’re asking for screenshot below.

 

 


Forum|alt.badge.img

so I did realize that under the Relation data field link there is this -

 

 

So that would explain how the result grid shows the Social Security output. But I’m still unsure how that would be changed to allow different values to show.


aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • October 24, 2023

Hi @brandontfrank 

There is no straight answer to your question, and you will not find all of the attributes in the out-of-the-box DAD definition. There are two general considerations. I believe I had provided a thorough explanation on a different topic related to the attributes but I can’t find it so I will try to explain to the best of my knowledge. Others might have a better solution:

  1. You will need to join your “EPEmployee” DAC to the GROUP OF ATTRIBUTE tables equal to the number of attributes that you want to retrieve. The reason is the attributes do not live in the associate record table. The attributes have their own dedicated table and are stored in rows and not in columns.
  2. Depending on the type of attributes that you are trying to retrieve, your approach will be different. The easiest retrieval will be string attributes and the most difficult one is the selector type attributes.

The GROUP OF ATTRIBUTE tables (this is what I call them not an official name) are:

CSAttribute : Stores the Attributes and its key field is AttributeID. For Example, if you create an attributed of list type to have dropdown values and call it “EC” and “Eye Color” it will be stored in this table.

CSAttributeDetail: Stores the predefined values of the Attributes. It stores all predefined values other than “Text” and “Selector”. Its key fields are AttributeID and ValueID. If in our above example you enter “BK” “Black”, “BR” “Brown and “BL” “Blue” they will be stoted in this table.

Now Acumatica platform needs to know what master entities (i.e. Employees, Projects, ...) can use which one of these Attributes. When in the Employee Preferences (note that some of these links may be configured behind the scenes and you do not see it) we say Employee record can use Attribute “EC” the platform stores the link between the Attribute and the Employee entity in the CSAttributeGroup table. Its key fields are AttributeID, EntityClassID and EntityType. The EntityType for Employees will be stored as “PX.Objects.EP.EPEmployee” if we need to filter on it. Most probably you will not need this table in your joins.

Now that the platform knows each entity what kind of Attributes can have, we can proceed with assigning the Attributes Values to each individual master record. This mapping stored in CSAnswers and its key fields are RefNoteID and AttributeID. The AttributeID abviously will need to be joind with CSAttribute but the RefNoteID is the NoteID of the master record we are trying to assign an attribute to it. For example, in Employee case the LEFT (because some employees may do not have attribute and still, we want them in the report) JOIN is EpEmployee.NoteID = CSAnswers.RefNoteID.

The value you want to show in your inquiry for string fields is CSAnswers.Value. Assuming all your values are string field, you will need to repeat this process for each attribute. For dropdown and selector it is a little bit more complicated. for example for selector still you will need to get the CSAnswers.Value from here, depending on the primary key of selector table join with that table and return the desired value from that table. For dropdown, you wiull need to join the CSAnswers.Value = CSAttributeDetail.ValueID and return the CSAttributeDetail.Description.

to add an example let say we have another attribute called “SX” “Sex” that has a dropdown value of “W” “Woman”, “M’ “Man” and “X” “Unknown”

 

I am writing my query in SQL format but you can easily translate to GI

 

SELECT

EMP.EmployeeCD, ANS1.Value, ATD2.Description

FROM

EPEmployee EMP

LEFT JOIN CSAnswers ANS1 ON EMP.NoteID = ANS1.RefNoteID

LEFT JOIN CSAttribute ATR1 ON ANS1.AttributeID = ATR1.AttributeID AND ATR1.AttributeID = ‘EC’

LEFT JOIN CSAnswers ANS2 ON EMP.NoteID = ANS2.RefNoteID

LEFT JOIN CSAttributeDetail ATD2 ON ANS2.AttributeID = ATD2.AttributeID AND ANS2.Value = ATD2.ValueID AND ATD2.AttributeID = ‘SX’


Forum|alt.badge.img
  • Freshman I
  • March 31, 2025

Thank you so much. I could create a GI based on the below logic:

SELECT

EMP.EmployeeCD, ANS1.Value, ATD2.Description

FROM

EPEmployee EMP

LEFT JOIN CSAnswers ANS1 ON EMP.NoteID = ANS1.RefNoteID

LEFT JOIN CSAttribute ATR1 ON ANS1.AttributeID = ATR1.AttributeID AND ATR1.AttributeID = ‘EC’

LEFT JOIN CSAnswers ANS2 ON EMP.NoteID = ANS2.RefNoteID

LEFT JOIN CSAttributeDetail ATD2 ON ANS2.AttributeID = ATD2.AttributeID AND ANS2.Value = ATD2.ValueID AND ATD2.AttributeID = ‘SX’

However, I am not able to take this logic to myob acumatica designer to generate a report. It says Noteid is not available in EPEmployee. Please anyone can help me in this It would be greatly appreciated.

Thanks,Suja


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • April 1, 2025

Hi ​@SujaFMS - If you don’t get what you need here, you should post in the MYOB forum. You can reference this post in a new post there. Cheers!

https://community.acumatica.com/myob-user-discussions-299


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings