You can translate the question and the replies:

Is it possible to show a dummy record in denodo when no data is present in the table .

Hi, Is it possible to show a dummy record in denodo when no data is present in the table . I need to show 'Dummy' values in all the columns when no records are found in the source. is it possibble to do that. Regards
user
11-12-2020 05:05:25 -0500

1 Answer

Hi, There are no staright forward method to achieve your use case. However it is possible with [partitoned View](https://community.denodo.com/docs/html/browse/latest/vdp/administration/optimizing_queries/automatic_simplification_of_queries/removing_redundant_branches_of_queries_partitioned_unions#removing-redundant-branches-of-queries-partitioned-unions). To do this kindly follow the below steps. 1. Create a new selection view(called bv_countries_Selection) over the base view (called bv_countries) and add a new field name called "dummyrecord" with hard-coded value 'N' and save the selection view. 1. Create a new view(for eg. bv_countries_dummy) using the same schema of the selection view created in the step 1. This new view should only return the dummy values for all the fields by quering the table dual(). `For eg: CREATE VIEW <View_name> AS SELECT 'xxxx' as field1,'yyyy' as field 2, 'Y' as dummayrecord from dual();` 1. Create a new UNION view on top of the new selection view which was created in Step 1 and new view which was created in Step 2 by associate fields between the views. 1. Navigate to the where condition of the UNION View and add the condition like below `dummyrecord = case WHEN ((SELECT count(*) AS count FROM bv_countries) = 0) THEN 'Y' ELSE 'N' END` 1. Now when you execute the UNION view, it will return the dummy record from the view (bv_countries_dummy) when the count(*) evaluates Zero in the case statement, otherwise it will return the data from the bv_countries_Selection view. Hope this helps!
Denodo Team
15-12-2020 05:58:39 -0500
You must sign in to add an answer. If you do not have an account, you can register here