Allow joins to use constant values or reference codes
Answered
I want to be able to use constants or reference codes when creating a join in the view builder. Obviously when using an inner join, you can just create a filter condition using a constant and achieve the same result, but for an outer join I have to be able to include the constant in the join condition itself. Using a filter on your base table in this case removes the left side of the join, which is contrary to the point of an outer join.
Hi Stephen,
Firstly apologies for the delayed response! Appreciate the level of detail you have provided, makes our job a lot easier :)
I'm moving this to a question (from idea) as I believe what you're after is already achievable.
What you're going to want to do is to create a report, and use a filter there.
At the view level, just make all your joins, so the view essentially returns everything.
Use the report to actually filter down the data, and apply sub-queries
Hope this helps, and please let me know if it doesn't.
Regards,
Daivd
Hi Stephen,
Firstly apologies for the delayed response! Appreciate the level of detail you have provided, makes our job a lot easier :)
I'm moving this to a question (from idea) as I believe what you're after is already achievable.
What you're going to want to do is to create a report, and use a filter there.
At the view level, just make all your joins, so the view essentially returns everything.
Use the report to actually filter down the data, and apply sub-queries
Hope this helps, and please let me know if it doesn't.
Regards,
Daivd
Thank you to whoever deleted Yulia's comment. It was incredibly rude and failed to understand my point. Not ideal qualities for consultants supporting this product.
David, I appreciate your response, but I don't think we're on the same page. The two SQL statements below are not identical. They produce different result sets. The first is what I'm after, the second is what I think your filter approach would create.
Query 1:
Query 2: The advantage I see in the first query is that I can aggregate metrics from TableA (where I want all Table A records) and TableB (without double counting, since TableA to TableB is a many to one relationship).If I can apply a filter at the subquery level rather than the report level, then I might be able to do this. At that point, the only issues are that the solution is more complex than simply having the feature I asked for (joining on a constant in the view) and I have to repeat it for every report I create, rather than doing it once at the view level.
I will test the subquery approach and see if it works.
Thank you to whoever deleted Yulia's comment. It was incredibly rude and failed to understand my point. Not ideal qualities for consultants supporting this product.
David, I appreciate your response, but I don't think we're on the same page. The two SQL statements below are not identical. They produce different result sets. The first is what I'm after, the second is what I think your filter approach would create.
Query 1:
Query 2: The advantage I see in the first query is that I can aggregate metrics from TableA (where I want all Table A records) and TableB (without double counting, since TableA to TableB is a many to one relationship).If I can apply a filter at the subquery level rather than the report level, then I might be able to do this. At that point, the only issues are that the solution is more complex than simply having the feature I asked for (joining on a constant in the view) and I have to repeat it for every report I create, rather than doing it once at the view level.
I will test the subquery approach and see if it works.
Hi Stephen,
sorry for being rude to you. I did not really mean that. There may be some cultural differences and I did not express myself in English correctly.
regarding to your business, both your queried produces the same results however if you are not happy with extra work that you do in subqueries with filters, there is another way of doing this in a view. Just start with tableB and left join tableA applying a condition to TableA.col2 = 1.
Sometimes, it is not possible to flip joins direction in a view without breaking the existing reports. In this case, your suggestion makes sense. However, I'll leave Yellowfin product team to decide on that.
There is another way to do your filter with left join. This will depend how big your TableB. You can do a virtual table where you can add a dummy column to tableB like SELECT col1, 1 as col2 FROM TableB. Then you can join it TableA in the way you described.
Regards,
Yulia
Hi Stephen,
sorry for being rude to you. I did not really mean that. There may be some cultural differences and I did not express myself in English correctly.
regarding to your business, both your queried produces the same results however if you are not happy with extra work that you do in subqueries with filters, there is another way of doing this in a view. Just start with tableB and left join tableA applying a condition to TableA.col2 = 1.
Sometimes, it is not possible to flip joins direction in a view without breaking the existing reports. In this case, your suggestion makes sense. However, I'll leave Yellowfin product team to decide on that.
There is another way to do your filter with left join. This will depend how big your TableB. You can do a virtual table where you can add a dummy column to tableB like SELECT col1, 1 as col2 FROM TableB. Then you can join it TableA in the way you described.
Regards,
Yulia
Replies have been locked on this page!