Count employee of department

Hi All,

Please help me about How count employee of department?

Thanks

Is Department dimension?

Where do you want to calculate and what did you try?

I want to calculate count of employee each department on Payroll

I tried to:

OnPostReport() trigger
employee.setfilter(“No.”,department.Code);
IF employee.“No.”<>’ ’ THEN
count+=1;

But it counts all employee. I need to count employee each department

Try with grouping the rreport with Department (Dimension)

Yes, I tried grouping by department with payroll line

What did you do?

can you explain steps?

  1. Grouping by department code on Payroll Line

  2. Sum of Salary amount /A70/

  3. OnPostReport trigger

employee.SETFILTER(“No.”,dep.Code);
IF employee.“No.”<>’’ THEN
count+=1;

But it isn`t count employees of each department. It counts all employees of all departments. I want to count each department.

Please find attach files.

Hi Undara,

One of the problems you may be facing here is the possibility that your Department dimension is not one of your Global Dimensions (you can check G/L Setup to find out). If Department is not Global Dimension 1 or 2, then the value you’re trying to filter the employee by isn’t even in the employee record. It’s in another record called Default Dimension.

Your easiest approach would be to start a new report, The first data item is t_349 Dimension Value, and you would filter this data item on the Dimension Code field, with the filter being set to whatever you’ve named you Department dimension (could be DEPT, DPT, whatever), you just make it a reqfilterfield in the data item property so users can do a lookup to get the right code value. You’ll also want to filter the Dimension Value Type field as Standard. You may need to create a new key for this table - Dimension Code, Code, Dimension Value Type, and select this key in the dataitemtableview property.

Your second data item is t_352 Default Dimension. You’ll indent this data item under Dimension Value, and set the dataitemlink property so that “Dimension value”.“Dimension Code” has a field relation to “Default Dimension”.“Dimension Code”. You’ll also filter Default Dimension dataitem so that Table ID = 5200 (the table ID for the Employee record in NAV2009). You’ve already filtered the Dimension Code when you set the dataitemlink property based on Dimension Code. And for this table as well, you’ll want to create a new key - Table ID, Dimension Code, Dimension Value Code., and chose this key as the dataitemtableview property.

Finally, to get the employee count, in the Default Dimension dataitem, in the OnAfterGetRecord trigger, add this code

setrange(“Dimension Value Code”, “Dimension Value Code”);

DeptCount := COUNT; \ you’ll need to create a global variable called DeptCount, of type Integer

setrange(“dimension value code”);

Then for the “Default Dimension” Body1 section, add two textbox controls. The source of the first textbox will be “Dimension Value Code”, and source of the second control will be DeptCount (which returns the count for the filtered Default Dimension record, which should be Table ID = 5200, Dimension Code = Department, and Dimension Value Code (the actual name of the Department) = whatever the value of the current record is.

That should get you the basic structure of the report. If you need to add details like a list of the employees in each department, that’s easy enough to do from this point. You could add a checkbox to the RequestOptions form to let the user decide at runtime whether to display the employee names, and you can decide how much information related to the employee that you want to display.

I hope this is helpful information for you.

Thank you George Love

It is working now

Regards

Undara