Ok, here is what I want to accomplish, and I have not come up with a way to do it yet. Looking for some suggestions on how to tackle it.
I have a custom app that I made where I am using UD Tables to store the data. The data is recursive once a column out of a list of columns is chosen. I have dropdowns for the user to select values and one of them is for which column is needed. I have a button that takes the values and runs a BAQ. My problem is I need to dynamically put that column in the select statement and also in the where statement.
So, what I am looking to roughly do is the following:
with CTE (Key1, Key2, Key3, Key4, Key5, Column, Level)
as
(
select Key1, Key2, Key3, Key4, Key5, *DynamicColumn*, 0 as Level
from UD01
where *DynamicColumn* <> ''
union all
select a.Key1, a.Key2, a.Key3, a.Key4, a.Key5, a.*DynamicColumn*, Level + 1
from UD01 as a
inner join CTE as b
on a.*DynamicColumn* = b.Key2
)
select *
from CTE;
I was thinking I might need to do a Function where I construct the BAQ myself, but am not sure. Any thoughts are appreciated.
If I were going to build a baq to use with this function, I would chose something that is definitely unique for the template column.
I’d say use a calculated field, but then we’d have to modify the query structure.
So just find something unique so you always know what you are replacing.
Thanks @klincecum , appreciate the help. There was a lot of changes that needed to be done, so I skipped the code and made @JasonMcD proud with widgets instead. It is working as I needed it too.