<?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>How to parse text to cdt values</title><link>https://community.appian.com/discussions/f/general/17446/how-to-parse-text-to-cdt-values</link><description>Hi All, 
 I have a text where user will be giving the information in text format , any ideas hot to parse that data to cdt ?? 
 Like usermight say , I am bhargavi from India .. from this need to extract as name : bhargavi , country : india something like</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to parse text to cdt values</title><link>https://community.appian.com/thread/68802?ContentTypeID=1</link><pubDate>Wed, 14 Aug 2019 02:11:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0a744b01-145a-41be-8dd3-f8882ebf9a6c</guid><dc:creator>ankitab0001</dc:creator><description>&lt;p&gt;Hi &lt;a href="/members/bhargavip0001"&gt;bhargavip0001&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is similar to implementing AI and AI is all about eliminating unlike choices. Having said that and referring to what &lt;a href="/members/stewart.burchell"&gt;Stewart Burchell&lt;/a&gt; mentioned, I have drafted this sample code. This is not the ideal way to implement this but is certainly one of the closest ways to get there. Hopefully, it gives you an idea in sort of which direction to go for.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;with(
  local!countries: {&amp;quot;India&amp;quot;, &amp;quot;UK&amp;quot;,&amp;quot;USA&amp;quot;},

  local!userText_words:split(ri!userTxt, &amp;quot; &amp;quot;),
  local!articles: {&amp;quot;a&amp;quot;, &amp;quot;an&amp;quot;, &amp;quot;the&amp;quot;},
  local!prepositions: {&amp;quot;of&amp;quot;,&amp;quot;from&amp;quot;,&amp;quot;on&amp;quot;,&amp;quot;in&amp;quot;, &amp;quot;to&amp;quot;, &amp;quot;within&amp;quot;,&amp;quot;with&amp;quot;,&amp;quot;at&amp;quot;},
  local!places: index(local!userText_words, wherecontains(local!countries,local!userText_words),{}),
  local!pronouns: {&amp;quot;I&amp;quot;, &amp;quot;We&amp;quot;, &amp;quot;She&amp;quot;, &amp;quot;He&amp;quot;, &amp;quot;They&amp;quot;, &amp;quot;him&amp;quot;, &amp;quot;her&amp;quot;, &amp;quot;their&amp;quot;, &amp;quot;his&amp;quot;},
  local!verbs: {&amp;quot;am&amp;quot;,&amp;quot;is&amp;quot;,&amp;quot;are&amp;quot;},

  local!names: difference(local!userText_words,{local!pronouns,local!prepositions,local!countries,
  local!articles, local!verbs}),
  local!cdt: &amp;#39;type!{urn:com:appian:types}candidatureDetails&amp;#39;(),
  a!sectionLayout(
    label:&amp;quot;&amp;quot;,
    contents: {
      a!textField(
        label:&amp;quot;Enter text&amp;quot;,
        value: ri!userTxt,
        saveInto:ri!userTxt
      ),
      
      a!columnsLayout(
        columns:{
          a!columnLayout(
            contents: {
              a!checkboxField(
                label:&amp;quot;Names&amp;quot;,
                choiceLabels: local!names,
                choiceValues: local!names,
                value:local!cdt.name,
                saveInto:local!cdt.name,
                showWhen: not(rule!APN_isEmpty(local!names))
              )
            }
          ),
          a!columnLayout(
            contents: {
              a!checkboxField(
                label:&amp;quot;Countries&amp;quot;,
                choiceLabels: local!places,
                choiceValues: local!places,
                value:local!cdt.communicationAddress,
                saveInto:local!cdt.communicationAddress,
                showWhen: not(rule!APN_isEmpty(local!places))
              )
            }
          )
        },
        showWhen: not(rule!APN_isEmpty(ri!userTxt))
      )
    }
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to parse text to cdt values</title><link>https://community.appian.com/thread/68771?ContentTypeID=1</link><pubDate>Tue, 13 Aug 2019 07:30:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:864c6e12-24ac-449e-a465-c235dc597aa0</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;Unless the text is in a structured form where you can guarantee a value by either its absolute position (e.g. characters 1 thru 30 represent &amp;#39;Country); or the text is delimited using, for example, commas (e.g. &amp;quot;India,&lt;span&gt;bhargavi,...&amp;nbsp;&amp;quot;) where we know the text before the first comma is the Country, the&amp;nbsp;&lt;/span&gt;second is name etc; or the text contains name:value pairs e.g. &amp;quot;Country: India, Name:&amp;nbsp;&lt;span&gt;bhargavi&amp;quot; then parsing text is going to impossible using conventional methods.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Assuming your text IS structured in one of the ones above, you can use different methods to extract the values you want, and then you an use Appian&amp;#39;s type! constructor to generate your CDT.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So, as a worked example, you can use the function split() to separate out a comma-separated string of text into its constituent&amp;nbsp;parts. The the type!constructor to create a CDT instance, referencing the relevant entry in the array of text that the split() function has generated.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to parse text to cdt values</title><link>https://community.appian.com/thread/68770?ContentTypeID=1</link><pubDate>Tue, 13 Aug 2019 07:28:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:eca725d7-3c50-455e-9e2c-4f278186f179</guid><dc:creator>aksharc</dc:creator><description>&lt;p&gt;Would user be entering data in specific format? And is it not possible to have separate&amp;nbsp;input components to collect such type of date?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>