Dynamically adding joins based on relation?
I have this setup:
I can easily refer to columns within the
circuit
table like circuitTable.name
or circuitTable.placeName
.
Can I also refer to relations to dynamically add a join?
E.g.:
and then based on user input I want to add some joins dynamically.
E.g. the user input could be sort on placeName
or country.name
, and in the latter case I want to add the country join.
As I have this in many places I would like to do something smart like:
based on such configs I wanted to apply the sort based on user input sort
field.
Would something like that be possible?3 Replies
Bump, anyone an idea?
@⚡Z.E.U.S⚡ sorry to bother you directly, but maybe you have an idea?
Maybe something like this?
thank you.
it would not be possible to - how must I explain - without the qb to define the leftJoin.
e.g.
and the apply that
join
field toward the qb
without the if?
if not , your solution already helps me a lot!