#FAQ: 10046-EN, Date: 7/16/2002

How to print the code or the name of the employee who runs a report ?


The information in this article applies to :
OroTimesheet 4.x (English)
OroTimesheet 4.x (French)


Description
Since the version 4.10 of OroTimesheet, 2 new functions are available into the reports generator. These functions are "GetLoggedUserCode" and "GetLoggedUserName". The "GetLoggedUserCode" function is used to return the code of the employee who runs the report while the function "GetLoggedUserName" is used to return the full name of this employee.

For example, the following command line will affect the full name of the employee who runs the report to the "Label1" label.

Label1.Caption := GetLoggedUserName;


Solution
The following tutorial shows you, step by step, how to use the "GetLoggedUserName" function. The GetLoggedUserCode" function can be used the same way.

Tutorial:

1. Run the reports generator.

2. Select the "List of activities" report (usually located in the "Lists" folder) and click the "Edit" button (you will get into the design environment of the reports generator).

3. Select the "File | Save as..." menu then type a new name for the report; for example "List of activities with employee name" then click "Save" (By doing that you will not modify the original version of the report "List of activities").

4. From the toolbar, click the "Label" button then click in the white space at the bottom left corner of the "Title" band to create a label object.

5. Repeat the step 4 to create an additional label at the right of the first one. Note that the second label should be named "Label3" since a label named "Label2" already exists in this report.

6. Select "Label1".

7. From the toolbar, locate the text area containing the text "Label1", then, replace this text by "Printed by:".

8. Select the "Calc" tab.

9. Select the "View | Events" menu.

10. From the "Report objects" window, select the object named "Report".

11. At the right, in the window containing the events list, select the "OnStartFirstPass" event.

12. From the "Procedure ReportOnStartFirstPass;" window, between the "Begin" and "End" commands, type the following command line:

Label3.Caption := GetLoggedUserName;

14. From the same window where you typed the command line, right click the mouse and select "Compile" from the popup menu. If you typed the command line correctly, you should get the message "Compile completed: 0 errors." at the bottom of this window. If you get an error message, verify that you typed the command line correctly and compile again.

15. Select the "File | Save" menu to save your changes.

16. Select the "Preview" tab to see the result. You should have at the bottom left of the "Title" band, the text "Printed by:" followed by your employee's name.


Status
Information

This applies only to version 4.10 or higher of OroTimesheet. If you do not use version 4.10 or higher of OroTimesheet, you can download the latest version from the downloads section of our web site.



© 1996-2008 OroLogic Inc.