How can I pick what timezone I want to see datetime fields in at runtime?

Version 2

    Verified Product Versions

    Service Desk 7.8.x

    The function attached was contributed to community by a very helpful customer and enables you to select which timezone you want to run a report's dates and times in, at the point of running the report.  As an example, it may be useful for managers who have support analyst staff located in different timezones to make sense of the data presented about a particular IPC, allowing them to select the most appropriate timezone, such as the support analyst's timezone, their own timezone, the customer's, etc.


    Here are some step by step instructions as an example of how to you could achieve this:


    1. Within Crystal Field Explorer, select to create a new Parameter field.  I will call this "TimeZone" in my example.
    2. Enter the required information under Prompting Text.  For example "Select the timezone to display date and time data in".
    3. Click on the Default Values button.
    4. Add in a default value of UK
    5. Add in a default value of Central Europe
    6. Save the Parameter field.
    7. Still within Crystal Field Explorer, select to create a new Formula.  I will call this "TimeZoneConversion" in my example.
    8. On the left hand section of the screen, right-click on Report Custom Functions and select new.
    9. Copy and paste the text in the attached datetimefunction.txt ensuring that you replace any text that was automatically placed into the function by Crystal.
    10. Select Save.
    11. On the left hand section of the screen, go back to your "TimeZone Conversion" formula under Formula Fields.
    12. Under the middle pane headed "Functions" locate the "Custom Functions" section and drag your "TimeZoneConversion" function into the editor panel (TIP: you can press ALT and X if you have been switched into Expert mode rather than Editor mode).
    13. The text TimeZoneConversion ( , ) is inserted for you.
    14. Drag the name of the datetime field that you want to convert into the first variable and the parameter field you created into the second variable.
    15. For example this could be TimeZoneConversion (pm_process.pm_creation_date , {?TimeZone}) to convert the date stored when raising a new IPC record.
    16. Save and check the formula.
    17. Now when running the report you are prompted to pick whether you want to see the data in UK or Central European format.


    NOTE: You could add in additional Default Values to the parameter field in order to cope with different timezones but would obviously need to add in the time adjustment within the function.


    IMPORTANT: As mentioned above, this function is not written and supplied by Landesk development so as such is not officially supported by Landesk.  However we try to pass on information to customers that they may well find useful to implement but I'm afraid that this must be done on the basis that we cannot correct any issues that may be found with the code within the function.