You can translate the question and the replies:

POST REST Query Using Data from Derived View

I have an query that is a POST that has several variables in the POST Body. I would like to get data from another Derived View and use the values from it to loop through the records and perform as many calls to the REST endpoint as there are records returned from the DV. Example: Derived View 1 - SELECT f1, f2, f3 FROM dv1 WHERE update_date >= CURRENT_DATE() Derivew View 2 - SELECT * FROM dv2 WHERE f1 = @f1_var and f2 = @f2_var and f3 = @f3_var dv2 does a POST to a REST endpoint using the f1, f2 & f3 variables to update an application Ideally I'd like to loop through the dv1 records and use the f1, f2 & f3 values to replace the @f1_var, @f2_var and @f3_var values respectively. My initial thought was to use a JOIN Derived View, joining dv1 to dv2 on the f1 to @f1_var, f2 to @f2_var and f3 to @f3_var values, but I'm not certain this will operate the way I hope. I'm open to any thoughts or suggestions. I would like to do this entirely in Denodo if at all possible instead of writing code to loop through the dv1 records and call dv2 with the values.
user
25-04-2023 15:22:03 -0400
code

1 Answer

Hi, If I wanted to take the data from one view and use it to query another view, I would create a JOIN view using the 2 derived views and join the values from one view to the view parameters in the other. Here are the steps I took. **dv1** was created from a base view **bv_test** with four columns **f1, f2, f3**, and **update_date** by making a selection view and setting a condition where **update_date = current_date()**. Then I created another derived view **dv2** by making another selection view and adding view parameters **f1_var, f2_var, f3_var**. In the WHERE conditions tab, I set **bv_test.f1 = f1_var, bv_test.f2 = f2_var** and **bv_test.f3 = f3_var**. Lastly, I created a join view joining **dv1** and **dv2** on **dv1.f1 = dv2.f1_var, dv1.f2 = dv2.f2_var** and **dv1.f3 = dv2.f3_var**. This allows me to loop through dv1 records. I deployed the join view as a REST web service. You can refer to [Parameters of Derived Views](https://community.denodo.com/docs/html/browse/latest/en/vdp/administration/creating_derived_views/creating_selection_views/creating_selection_views#parameters-of-derived-views) for more information. If you still need help and you have a valid support user account, please open a new case at the [Denodo Support](https://support.denodo.com/) site so that the support team can assist you. Hope this helps!
Denodo Team
01-05-2023 20:29:58 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here