<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Getting cdt data from a dse</title><link>https://community.appian.com/discussions/f/general/25028/getting-cdt-data-from-a-dse</link><description>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</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96953?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 19:56:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0daf8026-b466-472b-8312-47c96ef62bab</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Yeah, plus or minus a version.&amp;nbsp; AFAIK there might be a usable workaround if you need, like by populating an empty member of the data type then scraping the text for the property names.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96952?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 19:25:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4ad99032-07da-41c4-9112-1184d0d26568</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Nice!&amp;nbsp; We are not on a version that supports a!keys() yet :(.&amp;nbsp; I believe that was introduced in 21.4?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96951?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 19:18:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a1c3cabd-b020-467a-af2e-18a1c372a3e9</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I just whipped up this quick expression rule which, storing a list of data store entities and their accompanying CDTs, one can pass a DSE (like via constant) and it&amp;#39;ll find the matching item in the list.&amp;nbsp; If I were implementing this for real I&amp;#39;d probably store the list of maps in &amp;quot;local!pairs&amp;quot; in its own expression rule (for universality) and just reference it from this one.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!pairs: {
    a!map(
      entity: cons!APP_ENTITY_PERSON,
      type: &amp;#39;type!{urn:com:appian:types:APP}APP_Person&amp;#39;,
      typeId: tointeger(&amp;#39;type!{urn:com:appian:types:APP}APP_Person&amp;#39;),
      keys: a!keys(&amp;#39;type!{urn:com:appian:types:APP}APP_Person&amp;#39;())
    ),
    a!map(
      entity: cons!APP_ENTITY_EQIP_SUBMISSION,
      type: &amp;#39;type!{urn:com:appian:types:APP}APP_eQIPSubmission&amp;#39;,
      typeId: tointeger(&amp;#39;type!{urn:com:appian:types:APP}APP_eQIPSubmission&amp;#39;),
      keys: a!keys(&amp;#39;type!{urn:com:appian:types:APP}APP_eQIPSubmission&amp;#39;())
    )
  },
  
  local!index: where(local!pairs.entity = ri!dse),
  
  index(local!pairs, local!index, null())
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;As seen here, we can even have it directly provide us the CDT &amp;quot;keys&amp;quot; array as a member of the output set(!)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96950?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 19:11:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:75c0477c-819e-483c-bf5c-7a21840a3900</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Also, MariaDB should be similar for INFORMATION_SCHEMA.COLUMNS.&amp;nbsp; I would create a VIEW, then map a CDT/DS to the view, vs a stored procedure.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96949?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 19:07:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:822f66cf-49b1-4fe7-a8b5-192ec5725f6c</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;I was thinking creating a mapping as well - assuming new DSEs are not added that frequently?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96948?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 19:04:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:895ef107-411b-4e8a-a642-16b1fbb1e6fb</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Since each DSE has to map to a CDT, why not just make an expression rule that stores a key:value pairing with different DSEs and their matching CDT?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96947?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 17:30:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:236efe97-ff3a-4d2c-bf1b-b490e7df0aae</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;We&amp;#39;ve got MariaDB. I guess I&amp;#39;d pull this info up through a stored procedure. Question is how do I get the table name from the dse?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96946?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 17:09:49 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0f057c4c-f15e-45e0-9089-e075ef0926ab</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;No,&amp;nbsp;INFORMATION_SCHEMA.COLUMNS is the database definition and does not rely on data in the tables.&amp;nbsp; This is the MSSQL version, I&amp;#39;m not sure what you are using for an underlying database.&amp;nbsp; Just a thought for how you might be able to return columns per DSE/table regardless on data present.&lt;/p&gt;
&lt;p&gt;For instance, in this case we query for &amp;quot;chris_test_table&amp;quot; and are returned all column names, data types, etc in that table (more metadata is available).&amp;nbsp; The table is empty.&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1656436148170v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96945?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 17:04:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0817a24d-93cc-4697-a449-7cdbe729b514</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;Wouldn&amp;#39;t I still need something in the table to do that? I&amp;#39;m good on the Appian side if something is in there.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96944?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 17:03:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ea0a6c79-1f95-4a22-80ee-90399a0d0956</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;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.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96943?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 16:35:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1408045f-1a7f-491a-b893-fd4c00e7d505</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;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?&lt;/p&gt;
&lt;p&gt;I&amp;#39;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..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96942?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 16:31:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:376ff6f5-dd96-4c67-923c-f16d19d4dba6</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;That is an interesting challenge :-) Thank you for the explanation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96939?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 16:08:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9f3b1faf-6964-48a7-9ba9-c2eee1511bb8</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;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&amp;#39;s history table. Each activity has a different history table, so one of the rule inputs is the history table&amp;#39;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&amp;#39;m on step x.&lt;/p&gt;
&lt;p&gt;Now normally there is something in the history table, so&amp;nbsp;it being empty isn&amp;#39;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&amp;#39;d rather not do that if there is a better way.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96934?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 15:48:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d9f3ea77-d1d9-4699-abeb-b9be85422dd9</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;OK. Just out of curiosity, what is your use case?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96933?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 15:46:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1c78bdaa-240b-4b01-95bd-664521f85fd4</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;Because it&amp;#39;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.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96928?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 15:43:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:76dd80f9-9706-44ce-b093-12bc0a54e152</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;If this is static, why not just create a CDT from it? Then do a!keys() on that CDT.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting cdt data from a dse</title><link>https://community.appian.com/thread/96926?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 15:38:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:80ac1226-0fa2-4498-addc-2e443759934f</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;I haven&amp;#39;t&amp;nbsp;had a use case to do this with a DSE input, but I bet someone here will have a trick for you.&lt;/p&gt;
&lt;p&gt;Only thing I have done similar is created a view (MSSQL) based on the DB&amp;#39;s underlying INFORMATION_SCHEMA.COLUMNS details.&amp;nbsp; Used primarily in our COE for debugging truncation errors (when we have slack on field length validations in the interface - older environment).&amp;nbsp; Then I have an interface where you can select the underlying table, and it will display all of the data points by column.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="sql"&gt;SELECT TOP (100) PERCENT ROW_NUMBER() OVER (ORDER BY TABLE_NAME) AS Row, 
cast(TABLE_CATALOG as varchar(100)) &amp;#39;server&amp;#39;,
cast(TABLE_SCHEMA as varchar(100)) &amp;#39;schema&amp;#39;,
cast(TABLE_NAME as varchar(100)) &amp;#39;tableName&amp;#39;,
cast(COLUMN_NAME as varchar(100)) &amp;#39;columnName&amp;#39;,
cast(IS_NULLABLE as varchar(10)) &amp;#39;nullable&amp;#39;,
cast(DATA_TYPE as varchar(100)) &amp;#39;dataType&amp;#39;,
cast(CHARACTER_MAXIMUM_LENGTH as int) &amp;#39;maxLength&amp;#39;
FROM INFORMATION_SCHEMA.COLUMNS&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>