Oracle Analytics Cloud and Server

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

How to show a custom data when there aren't datas

Received Response
71
Views
19
Comments
2»

Answers

  • Barticchia
    Barticchia Rank 4 - Community Specialist

    Chris,

    with union query i'll see in all cases dummy record...right?

    or i'll see dummy record only when the first query is empty?

  • [Deleted User]
    [Deleted User] Rank 2 - Community Beginner

    All cases. That's why  said to maybe push the logic to the view itself.

    a) then you dont need to build exception handling in the front-end and can just work normally

    b) the heavy lifting and logic is offloaded to the source

  • Barticchia
    Barticchia Rank 4 - Community Specialist

    Ciao Chris

    Could it works?

    create a new table on RPD and make an sql as source:

    <span class="kwd">select</span><span class="pln"><br/>  'A'</span><span class="pun">,</span><span class="pln"> 2<br/></span><span class="kwd">from</span><span class="pln"> my view<br/></span><span class="kwd">where</span><span class="pln"> category </span><span class="pun">=</span><span class="pln"> </span><span class="pun">@</span><span class="pln">variable<br/></span><span class="kwd">union</span><span class="pln"> </span><span class="kwd">all</span><span class="pln"> </span><span class="pln"><br/></span><span class="kwd">select</span><span class="pln"><br/>   </span><span class="lit">''</span><span class="pun">,</span><span class="pln"> -1</span><span class="pln"><br/></span><span class="kwd">where</span><span class="pln"> </span><span class="kwd">NOT</span><span class="pln"> </span><span class="kwd">EXISTS</span><span class="pln"> </span><span class="pun">(</span><span class="kwd">SELECT</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="kwd">FROM</span><span class="pln"> my view </span><span class="kwd">where</span><span class="pln"> category </span><span class="pun">=</span><span class="pln"> </span><span class="pun">@</span>variable<span class="pun">)</span>

    what do you think?

  • [Deleted User]
    [Deleted User] Rank 2 - Community Beginner

    Pretty sure some hardcore db developer could write a super nice piece of code for you there   Ask your database guys or whoever has initially written the view.

    But yes your code should be fine as well.

  • Thomas Dodds
    Thomas Dodds Rank 8 - Analytics Strategist

    Depending on volume of your data a SQL based table / Opaque view is going to under perform ...  it's been mentioned 'do it on the source' - I second and third that advice.

  • Barticchia
    Barticchia Rank 4 - Community Specialist

    Hi everyone:

    On Sql, this works fine:

    select

        DCNN,VALUECPS,NETWORKOPERATOR

    from OPERA_INV_BE_DEV.V_AMUSER_CPS

    where DCNN = '000000'

    union all --edit, of course it's quicker

    select

        '0',-1,''

    where NOT EXISTS (SELECT DCNN,VALUECPS,NETWORKOPERATOR

    from OPERA_INV_BE_DEV.V_AMUSER_CPS

    where DCNN = '000000')

    If i use this code in a new Table (Physical RPD), how can i pass variable?

    where DCNN = @prompt_DCNN will it works?

    How can i get dynamic results?

    many thanks

  • Thomas Dodds
    Thomas Dodds Rank 8 - Analytics Strategist

    "Depending on volume of your data a SQL based table / Opaque view is going to under perform" ... no predicate filtering.  Using an opaque view brings ALL data back and let's BI server filter ...

  • Barticchia
    Barticchia Rank 4 - Community Specialist

    hi to everyone...

    first of all i'd like to thank you for support and your tips.

    i solved issue with a view and a union all with a dummy record.

    In analysis, i filtered with a rcount(1).

    rcount(1) >= Case when la max(rcount(1)) >1 then 2 else 1 end

    in this way i have what i need.

    Thanks again guys

    SB

  • Thomas Dodds
    Thomas Dodds Rank 8 - Analytics Strategist

    Then please mark the comments that were helpful and mark the question answered - helps other who are searching with the same issue.