You can translate the question and the replies:

View with input parameters

Hello Team, Consider my scenario. So i have query something like this. WITH userdata AS ( SELECT id from user where user_name in (**user_list**) and user_status='Active' ), payment as( select * from payment where payment_status=1 and payment_user in (select id from userdata) ) select order.id from order, payment where order.paymentid=payment.id and order.orderstatus=1 In above query, i have a user_list(marked in bold) is a list of users which i want to pass at a runtime. Above is query to make a view. So i want that user_list should be a variable and the list of users(which will be array of string values) i will pass at runtime. Note: users is a list usernames and which is array of string values like 'Tom','John' So how can i achieve this. I want to expose it as REST API and i will pass user_list to that api endpoint.
user
26-06-2020 06:29:26 -0400

1 Answer

Hi, You can create a view parameter if you wish to take in an input parameter at runtime. You can do this simply by creating a Selection view on top of this view and create 'View Parameter' in the Model tab. Then in the Where conditions you can add the conditions of WHERE user_list = <view_parameter_name> This should allow you to achieve the requirements and you can also expose the view as a web service and still pass the list as the value of the view parameter. You can refer to [Parameters of Derived Views](https://community.denodo.com/docs/html/browse/7.0/vdp/administration/creating_derived_views/creating_selection_views/creating_selection_views#parameters-of-derived-views) section of the Virtual DataPort Administration Guide for more information. Hope this helps!
Denodo Team
29-06-2020 03:49:06 -0400
You must sign in to add an answer. If you do not have an account, you can register here