I have an expression that takes in a dse and spits out the column names of everything in that dse. Unfortunately, the way it does this is by querying the dse and then running a!keys() on the first entry of the result to figure that all out. While this works perfectly well when the dse has values in it, it will error out if the table is empty. So is there any way to get the same information directly from a DSE that doesn't have data in it?
Discussion posts and replies are publicly visible
If this is static, why not just create a CDT from it? Then do a!keys() on that CDT.
Because it's not static. I basically have to figure out what the table looks like from the dse input so I can populate/query the table regardless of which table it is.
OK. Just out of curiosity, what is your use case?
I have a milestone component that is used across everything in the application. There are various different activities that require the milestone, but each has its own set of steps. The steps themselves are held in one table that basically builds out the milestone based on the name of the activity type. But to know which step on the milestone the milestone is supposed to be, I need to query up data from that particular activity's history table. Each activity has a different history table, so one of the rule inputs is the history table's dse. The layouts of these tables are all different, so I need to be able to basically pull up the list of column names and figure out which column has the exact data I need to tell the milestone I'm on step x.
Now normally there is something in the history table, so it being empty isn't USUALLY a big deal, except for the very first time you create a particular activity of a particular type. I can manually throw in some dummy value in the backend of course, but I'd rather not do that if there is a better way.
That is an interesting challenge :-) Thank you for the explanation.
If you can create a mapping of DSE to TABLE NAME, you may be able to use my solution to reference the columns via something such as INFORMATION_SCHEMA.COLUMNS - are you on MSSQL?
I'm not sure if it is possible to access table name dynamically via DSE input, but I have seen some work magic with XML on here for related situations..
Thanks. It works really well and saves us the trouble of configuring a new milestone each time we come up with a new activity or need to rework the flow of an existing activity. This one minor kink aside anyway.