Oracle Analytics Publisher

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

Bi Publisher - add x days to a date element in rtf template

Received Response
1379
Views
6
Comments
User638087-Oracle
User638087-Oracle Rank 3 - Community Apprentice

Hi All,

Is there any function we can use to add 'X' days to a date element in an RTF template ?  

One way I can think of is deriving it in the data model but just curious if any functions available in format:date or so  ?

Thanks in advance

Answers

  • Gabriel Grigorie-Oracle
    Gabriel Grigorie-Oracle Rank 3 - Community Apprentice

    Hello

    You can use the

    https://blogs.oracle.com/xmlpublisher/entry/groovy_date_functions

    <?xdoxslt:ora_format_date_offset('2009-06-03',position(), '+')?> , as per blog example

    Regards
    Gabriel

  • User638087-Oracle
    User638087-Oracle Rank 3 - Community Apprentice

    Many thanks for your response.. Found an other means just now with  a bit of trial and error..

    <?format-date:(xdoxslt:ora_format_date_offset(xdoxslt:ora_format_date(PRINT_DATE_TIME,'YYYY-MM-DD'),14,'+'));'DD MONTH YYYY'?>

  • Gabriel Grigorie-Oracle
    Gabriel Grigorie-Oracle Rank 3 - Community Apprentice

    Dear

    Thank you for your feedback and also i'm glad that the issue has been resolved.

    If one of the answers helped you or answered to your request kindly please mark the answer as Helpful or mark as Correct Answer

    Regards

    Gabriel

  • User453089
    User453089 Rank 1 - Community Starter

    Hi Team,

    I have this requirements: To Add 1 day to payment date in the rtf but exclude week end.

    I come up with this conditions below but no output when tried to display the date.


    --PaymentDate xml value is 2022-06-03 --

    <?xdofx:if to_date(PaymentDate,'D') = 6 then 

    format-date:(xdoxslt:ora_format_date_offset(xdoxslt:ora_format_date(PaymentDate,'YYYY-MM-DD'),3,'+'));'DD MONTH YYYY' -- Output date is monday

    else

    if to_date(PaymentDate,'D') = 7 then 

    format-date:(xdoxslt:ora_format_date_offset(xdoxslt:ora_format_date(PaymentDate,'YYYY-MM-DD'),2,'+'));'DD MONTH YYYY' -- Output date is monday

    else

    format-date:(xdoxslt:ora_format_date_offset(xdoxslt:ora_format_date(PaymentDate,'YYYY-MM-DD'),1,'+'));'DD MONTH YYYY' -- plus 1 day

    end if?>

  • User_B3V2A
    User_B3V2A Rank 1 - Community Starter

    Hi everyone, just found this thread today.

    I just wanted to share the way I did it, which is basically the same:

    Adds ‘x’ number of days to the given date_in field <?xdofx:date_in?>. Output is rendered in the same date format as that of ‘date_in’ field. 

    Example using 'HIRE_DATE'

    <?xdoxslt:ora_format_date_offset(HIRE_DATE,1,'+')?>

  • Kaustubh Deshmukh
    Kaustubh Deshmukh Rank 3 - Community Apprentice

    I have a <PAYMENT_DATE>2024-02-26</PAYMENT_DATE> column in XML file and I am using this value I need to bring back previous sunday and Saturday dates in RTF templates , Is there any function not available to get day of the week