Dynamic Formatting in Web Intelligence

You can get the response string to a prompt using Web Intelligence function UserReponse(). However the function returns string value which is formatted according to Web Intelligence preferred locale. To make handling of date strings independent on the locale, dynamic formats can be used.

Dynamic Formats in ToDate Function

To convert the date prompt string into date, ToDate function can be used.

  date ToDate(date_string;format)

If locale is French (Canada), the format should be “yyyy-MM-dd HH:mm:ss”.

For example,

= ToDate(UserResponse("Date:");"yyyy-MM-dd HH:mm:ss")

To make a report independent on the format (and correspondingly the locale), the dynamic formats can be used. The dynamic input formats are “INPUT_DATE_TIME”, “INPUT_DATE”.

So:

= ToDate(UserResponse("Date:");"INPUT_DATE_TIME")

Handling Date and DateTime Format

Before SP2 of BOE XI 3.1, the user could enter date in both date and datetime format, and conversion using specific format would not work correctly in all situations. The formula that accounts the both possible formats:

=If(IsError(ToDate(UserResponse("Date:");"INPUT_DATE"));
            ToDate(UserResponse("Date:");"INPUT_DATE_TIME");
            ToDate(UserResponse("Date:");"INPUT_DATE"))

Dynamic Formats with FormatDate

The dynamic formats can be used in FormatDate() function.

 =FormatDate(CurrentDate();"LONG_DATE")

BusinessObjects documentation does not list the available dynamic formats. Some of them can be found in dialog “Number Format”.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s