Friday, 28 July 2017

Filter a data Based on input parameter value in SAP HANA

Scenario:
Filter the data Based on Region but the option should be available to Select the Region for the user.


Solution:
  1. Create a Cube Calculation View. Here I named it as “CV_RESTRICTED_US”.
  2.  Drag and Drop the required tables in a Separate Projection node and Join them based on matching fields. Here I used “KNA1”, “T005T” and “T005U”.
  3.  Join 1 as Shown Below:
  4. Join 2 as Shown Below:
  5. Finally, it looks like:
  6. Create an input parameter to hold values of selection for “Region” from the user as shown below:
  7. Now Let us create the filter using “Expression” as shown below:
  8. Right click the Projection 1 or some other node which contains Region field and select “Apply Filter”.
  9. Now you can see the Expressions under Filter in output panel in the right side.
  10. Now enter the following expression in Expression Editor:  in("LAND1",'$$SELECT_REGION$$') or match ("LAND1",'*$$SELECT_REGION$$*')
  11.  Finally, validate and activate the view.
  12. Results: 
  • input parameter pop up window will appear and select a required region. Here I choose “BR”. And then Click ok.
d


  •        Data Preview

  NOTE:
        In the Expression Editor:
             IN Clause: To allow Multiple Values
             MATCH: To allow "All" value if User Passes

THANK YOU FOR VISITING MY BLOG...
SHARE YOUR COMMENTS...

2 comments:

  1. Hi,

    Thank you for sharing your knowledge.

    Do you mind explaining how to add a valid code in Semantics node for a variable using Expression Editor? The output should be a help value extracted from a specific view column based on the current user.

    Thank you in advance for your time.

    Best regards,
    Aurelia

    ReplyDelete