How can I get the current user site or plant

I would like to add the current users plant to an RDD for reporting.

Does anyone know where the current user site (or plant) field is kept? I do not see it in userfile.

DaveO

Found it - The Table is UserComp.Plant

DaveO

I don’t think its saved during a session. You can use a BPM to enter it into a UD or unused field.

I think that only gets updated when the user exits, and is used to select the plant for the next session. If you change plants during a session, that value doesn’t change.

EDIT

I’ve confirmed this. So that field only shows what site they were in when they last closed the client. Not which one they are currently in.

Mr. Calvin: Thank you - you are correct - it is not saved during a session.

The BPM seems like a long way to go to get the current plant.

DaveO

Some reports do include the plant (particularly the Inventory ones). Take a peak at their RDD’s to see if anything jumps out.

The plant/site is passed to a temp-table CallContextClientData every time the report is run (alongside the RDD temp tables and CallContextBpmData). You can add this table to your data set query with it’s respective GUID, and get the CurrentPlant field that way.

1 Like

Adding something like this to your data set query should work fine just fine (to get the Site/PlantId atleast). No RDD modification required.

T2.CurrentPlant
LEFT OUTER JOIN CallContextClientData_" + Parameters!TableGuid.Value + " T2
ON T1.Company = T2.CurrentCompany"

1 Like

Mr. Adam: Thank you for the tip.

I needed the Plant name also - so I added the full plant table to the RDD and then joined the CurrentPlant to Plant.Plant and I was able to get the Plant.Name.

Thank you again,

Although, it does make me think how can I show the current plant on a dashboard?
DaveO

1 Like

Very nice! No problem!

The CallContextClientData fields are also available as EpiBindings in a customization. Might need to do a little extra work to get the plant name.