Oracle Analytics Cloud and Server

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

Finding Minimum value in rtf template

Received Response
63
Views
4
Comments

Summary

Finding Minimum value in rtf template

Content

Hii,

I calculated  shipment days from delivery_date and order_date in RTF template.

code is as follows 

<?xdoxslt:date_diff(‘d’,

ORDER_DATE,DELIVERY_DATE,

$_XDOLOCALE, $_XDOTIMEZONE)?>

I wrote this code inside for each loop.so now i need to find minimum value from these shipment days.

How will be the code ?

Reply asap

Thank you

Answers

  • timdexter
    timdexter Rank 6 - Analytics Lead

    Hi

    BIP has the concept of variables (check the docs) so you could create a variable x to hold an initial value of say 10000. In the loop, check the value of the calculation against the variable value and update it accordingly. At the end of the loop you would have the lowest value.

    TBH thou, I think I would push all of this into the data model. Have a field in the query that calcs the difference. Then create a summary column at the report level that looks for the min value. It will perform much better in the data model and the layout template will be cleaner

    Tim

  • Vinithasaraswathy
    Vinithasaraswathy Rank 3 - Community Apprentice

    Okay..Thank you..

  • timdexter
    timdexter Rank 6 - Analytics Lead

    Ahhh ... thats a slightly different question. You don't want the minimum value, you want the invoice number that has the lowest amount correct?

    For that I'd use a second query to get that id, something like

    select invoice_num

    from invoices

    where rev = (select min(rev) from invoices)

    You could do it in the template but again, its going to be expensive in terms of time and processing and its better to push it to the data model.

    What happens in the maybe rare case that you have two or more invoices with the same lowest value? The query above will return two rows and you can loop through them in the template to show them.

    Tim

  • Rajesh123
    Rajesh123 Rank 6 - Analytics Lead
    timdexter wrote: Then create a summary column at the report level that looks for the min value. It will perform much better in the data model and the layout template will be cleanerTim

    Hi,

    The summary column will display only one value if i run the program ?

    Let's say ,I have Invoice#1234 to 2390...then if i do like above as you suggested , then i will get Invoice# 2390 correct?

    Please suggest if i am thinking wrong.