Home Discussions Questions & Answers Dynamic Default Parameter Values using SQL

Dynamic Default Parameter Values using SQL

Avatar photoCustomer March 4, 2024 at 9:34 am

I have a report requiring a period parameter. I want the default value to automatically populate with the current system date, but formatted specifically in the GL period format (e.g., MON-RR). How do I define this dynamic default value?

Viewing 8 reply threads
  • Author
    Replies
    • Support March 5, 2024 at 8:26 pm  

      To set a dynamic default value based on SQL, you define the parameter’s Default Value starting with the keyword `select` . For your requirement, you can use the SQL `select to_char(sysdate, ‘MON-RR’) from dual` . Blitz Report executes this SQL statement at runtime to derive the default value, which is particularly useful for defaulting dates, user IDs, or other session-dependent information .

    • Avatar photoCustomer March 6, 2024 at 7:12 am  

      I noticed some documentation suggesting that basic functions like `TO_CHAR` can be used without the `FROM dual` clause. Is this possible, and if so, which functions support this simplification?

    • Support March 6, 2024 at 12:53 pm  

      Yes, to simplify report development, several functions can be used in default value definitions without needing to select from `dual` . These functions include standard mathematical and string manipulation functions such as `abs`, `add_months`, `coalesce`, `decode`, `length`, `lower`, `nvl`, `to_char`, `to_date`, and `upper`, among others listed in the source documentation . This provides a cleaner syntax when calculating simple default values.

    • Avatar photoCustomer March 8, 2024 at 3:17 pm  

      If I want to default an email address for a report author based on the current user’s record, how would that SQL look?

    • Support March 8, 2024 at 10:22 pm  

      To dynamically default the author’s email based on the current user, the SQL would typically join `FND_USER` with `PER_ALL_PEOPLE_F` using `FND_GLOBAL.USER_ID`. A complex example provided includes checking both the user’s direct email address and their person record email, using `coalesce` to return the first non-null result: `select coalesce(fu.email_address, (select papf.email_address from per_all_people_f papf where fu.employee_id=papf.person_id and sysdate between papf.effective_start_date and papf.effective_end_date)) email from fnd_user fu where fu.user_id=fnd_global.user_id` , .

    • Avatar photoCustomer March 10, 2024 at 10:05 am  

      If a required date parameter is of type ‘Date’, will the system convert the entered value to the server time for SQL execution?

    • Support March 11, 2024 at 3:06 pm  

      If the parameter type is set to Date, the entered parameter value is used as a bind variable for SQL execution without any timezone conversion, effectively binding to midnight of the date entered . However, if the parameter type is set to DateTime and you have timezone conversions enabled, the entered parameter value *will* be converted to server time before being used as a bind variable for SQL execution .

    • Avatar photoCustomer March 12, 2024 at 3:44 pm  

      Is there a mechanism to reorder parameters easily if I realize I need to insert a new one in the middle of a sequence?

    • Support March 13, 2024 at 6:40 pm  

      Yes, Blitz Report provides a utility specifically for this purpose under Tools > Resequence parameters . This function automatically assigns new sequence numbers to your parameters, ensuring there is spare room between sequence numbers again, which allows you to easily insert new parameters into the required display order without manual sequence number adjustment conflicts .

Viewing 8 reply threads
  • You must be logged in to reply to this post.

Login with: