<?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>String validation</title><link>https://community.appian.com/discussions/f/general/18344/string-validation</link><description>Hi , 
 
 How can we apply string data validation in the textfield in Appian. I have a requirement in which the first two alpahbets, should be either a or A and the second one will be c or C. In short for a particular string , how can i check the character</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: String validation</title><link>https://community.appian.com/thread/138262?ContentTypeID=1</link><pubDate>Thu, 18 Jul 2024 10:41:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4ec76970-ec03-4780-89af-a56a63bbb851</guid><dc:creator>erikd8280</dc:creator><description>&lt;p&gt;&lt;span&gt;I&amp;#39;m not sure if that&amp;#39;s entirely true&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color:#ffffff;font-size:75%;"&gt;&lt;a style="color:#ffffff;" href="https://basketballstars-game.io"&gt;basketball stars&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72558?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 11:15:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3fb87b8a-dba8-4140-8621-1061d735ba60</guid><dc:creator>ST07</dc:creator><description>&lt;p&gt;ohh , thanks for the detailed explanation . So , i think as of now , we dont have any fuction to validate input string as a date format. We have to make customized validation check for that or using regex functions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72548?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 15:14:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0eecaf84-2966-4fdc-a2e9-868be08b8b10</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;There&amp;#39;s two things going on here. First is the representation of a date value as a number. If you ever try to convert a date to an integer, the number represents the number of days before or after 1 January 2035 (see the &lt;a href="https://docs.appian.com/suite/help/latest/fnc_conversion_todate.html#notes"&gt;todate()&lt;/a&gt; function docs for more information). So in the case you gave above, 38353 is considered that many days after 1 Jan 2035, which results in 3 Jan 2140.&lt;/p&gt;
&lt;p&gt;The second thing to consider is the method Appian uses to display dates using the text function. The text function can display many kinds of date formats depending on what format is provided as the second parameter. For example, the following options all display some kind of month:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;quot;m&amp;quot; --&amp;gt; returns the month number without leading zeros; for example, January would be 1 and November would be 11&lt;/li&gt;
&lt;li&gt;&amp;quot;mm&amp;quot; --&amp;gt; returns the month number with leading zeroes;&amp;nbsp;&lt;span&gt;for example, January would be 01 and November would be 11&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&amp;quot;mmm&amp;quot; --&amp;gt; returns the three letter name of a month; for example January would be Jan and November would be Nov&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&amp;quot;mmmm&amp;quot; --&amp;gt; returns the full month name&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;All that being said,&amp;nbsp;this function is used to go from a number to a string, but I believe you want the opposite (go from the text month name to a number). The best way to do this is to use choiceValues to save the number for month instead of the text name like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!month,
  a!dropdownField(
    choiceLabels: {
      &amp;quot;Jan&amp;quot;,
      &amp;quot;Feb&amp;quot;,
      &amp;quot;Mar&amp;quot;
    },
    choiceValues: {
      &amp;quot;01&amp;quot;,
      &amp;quot;02&amp;quot;,
      &amp;quot;03&amp;quot;
    },
    value: local!month,
    saveInto: local!month,
    placeholderLabel: &amp;quot;--Select Month--&amp;quot;
  )
)&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72547?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 15:06:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3b173174-4f75-48f5-9682-607549e19621</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;In general for dates, the text function is really only useful if the value you&amp;#39;re starting with is an actual date value - i.e. &amp;quot;&lt;em&gt;&lt;strong&gt;text(now(), &amp;quot;mmm/yyyy&amp;quot;)&lt;/strong&gt;&lt;/em&gt;&amp;quot; would work well, but i don&amp;#39;t know if it would work very well with inputs that aren&amp;#39;t a date value or something corresponding to this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72544?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 14:41:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a1210b5c-d749-4c6d-93e7-dd847027ef35</guid><dc:creator>ST07</dc:creator><description>&lt;p&gt;Thanks mike , both the approach works fine.&amp;nbsp; I had this last doubt , like in documentation how is&amp;nbsp;text(38353, &amp;quot;mmm/dd/yyyy&amp;quot;)&amp;nbsp; &amp;nbsp;returns&amp;nbsp;&lt;i class="SelectableTreeNode---icon SelectableTreeNode---openCloseLink"&gt;&lt;/i&gt;&lt;span&gt;&lt;span class="CollapsibleOutputNode---print_value"&gt;&amp;quot;Jan/03/2140&amp;quot;&lt;/span&gt;&lt;span class="CollapsibleOutputNode---print_element_type"&gt;(Text)&amp;nbsp; &amp;nbsp; &amp;nbsp;. Actually i thought of using text function to convert input value to date type string. How this date is being calculated?&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72542?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 14:12:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:82cd3d4c-1343-4114-b5c0-ae465425e419</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;When you have a dropdown field whose value will initially be null (so, most of the time), you need to also set a &amp;quot;placeholder label&amp;quot; value -- this is usually just text that will help the user know what to do, and shows up when the value is NULL, but doesn&amp;#39;t count as a valid selection if the field is required.&amp;nbsp; Setting this correctly will cause your error message to go away.&lt;/p&gt;
&lt;p&gt;e.g.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!year,
  a!dropdownField(
    choiceLabels: {
      &amp;quot;2020&amp;quot;,
      &amp;quot;2021&amp;quot;,
      &amp;quot;2022&amp;quot;
    },
    choiceValues: {
      &amp;quot;2020&amp;quot;,
      &amp;quot;2021&amp;quot;,
      &amp;quot;2022&amp;quot;
    },
    value: local!year,
    saveInto: local!year,
    placeholderLabel: &amp;quot;--Select Year--&amp;quot;
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;(also, i fixed the choiceLabels and choiceValues - these should be arrays, the way you had them they were just strings that would cause them to only show up as one option instead of three)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72541?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 14:10:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:70c90c22-abfa-4f90-afec-02f6dfec25b1</guid><dc:creator>ST07</dc:creator><description>&lt;p&gt;included a null check also for this ,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;a!dropdownField(&lt;br /&gt; choiceLabels: {&lt;br /&gt; &amp;quot;jan,feb,march&amp;quot;&lt;br /&gt; },&lt;br /&gt; choiceValues: {&lt;br /&gt; &amp;quot;jan,feb,march&amp;quot;&lt;br /&gt; },&lt;br /&gt; value: if(isnull(local!month),{},local!month),&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;i am not sure how this thing works, initially year and month variables will be null only , user will enter the values.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72540?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 14:05:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1ed56178-04af-47ec-8708-20d0c1ff01fc</guid><dc:creator>ST07</dc:creator><description>&lt;p&gt;Hi , thanks it works when i replace that with null.&amp;nbsp; i tried using that with dropdwon also, but i got an error . its basically an editble grid . i need to save month end key in mm/yyyy format. for dropdown , i have made 2 dropdown for year and month. But when i click on add rows dynamic link , error is there.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Interface Definition: Expression evaluation error at function a!forEach [line 60]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function a!dropdownField [line 90]: A dropdown component [label=&amp;ldquo;&amp;rdquo;] has an invalid value for &amp;ldquo;value&amp;rdquo;. Value cannot be null.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt; a!dropdownField(&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -------------&amp;gt;&amp;gt;&amp;gt;&amp;gt; line 90&lt;br /&gt; choiceLabels: {&lt;br /&gt; &amp;quot;jan,feb,march&amp;quot;&lt;br /&gt; },&lt;br /&gt; choiceValues: {&lt;br /&gt; &amp;quot;jan,feb,march&amp;quot;&lt;br /&gt; },&lt;br /&gt; value: local!month,&lt;br /&gt; saveInto: local!month&lt;br /&gt; ),&lt;br /&gt; a!dropdownField(&lt;br /&gt; choiceLabels: {&lt;br /&gt; &amp;quot;2020,2021,2022&amp;quot;&lt;br /&gt; },&lt;br /&gt; choiceValues: {&lt;br /&gt; &amp;quot;2020,2021,2022&amp;quot;&lt;br /&gt; },&lt;br /&gt; value: local!year,&lt;br /&gt; saveInto: local!year&lt;br /&gt; ),&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;my plan is to take both these local values , append them , include a &amp;quot;/&amp;quot; string in between and save in the&amp;nbsp;ri!monthEndCDT.monthendkey.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72539?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 13:49:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:998fc7c6-397a-4a6a-8640-7e6ed9a2bacf</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;So when you set up a validation in Appian, the result of the validations parameter should either be some text (which is what will display as the error message) or null. If a text is returned, Appian assumes that a validation should be triggered, while null means no validation should show. If you want to use the expression above, you will probably need something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!textField(
  value: ri!monthEndCDT.monthendkey,
  saveInto: {
    ri!monthEndCDT.monthendkey
  },
  validations: if(
    and(
      like(
        ri!monthEndCDT.monthendkey,
        &amp;quot;[0-9][0-9]/[0-9][0-9][0-9][0-9]&amp;quot;
      ),
      len(ri!monthEndCDT.monthendkey&amp;lt;7)
    ),
    null,
    &amp;quot;enter valid date Value MM/YYYY&amp;quot;
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;That being said, I still wouldn&amp;#39;t recommend using a text field for this - two dropdowns would probably work a lot better and be more clear for the user.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72538?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 13:42:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a84aa4f7-2e57-47a2-b25a-e7c90806a85e</guid><dc:creator>ST07</dc:creator><description>&lt;p&gt;i tried that , but the date field&amp;nbsp; calender thing should not be&amp;nbsp; visible to end user, so thats why im using the text field with validation ,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;a!textField(&lt;br /&gt; value: ri!monthEndCDT.monthendkey,&lt;br /&gt; saveInto: {&lt;br /&gt; ri!monthEndCDT.monthendkey&lt;br /&gt; },&lt;br /&gt; validations: if(&lt;br /&gt; and( like(&lt;br /&gt; ri!monthEndCDT.monthendkey,&lt;br /&gt; &amp;quot;[0-9][0-9]/[0-9][0-9][0-9][0-9]&amp;quot;&lt;br /&gt; ), len(ri!monthEndCDT.monthendkey&amp;lt;7)),&lt;br /&gt; &amp;quot;valid date&amp;quot;,&lt;br /&gt; &amp;quot;enter valid date Value MM/YYYY&amp;quot;&lt;br /&gt; ),&lt;br /&gt; &lt;br /&gt; ),&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But this&amp;nbsp; is displaying error message in both cases, valid and invalid both. It works but for valid value also , it displays red errored out&amp;nbsp; textfield&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72536?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 12:52:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dd80df83-7785-48b6-ab41-049ef0ed4e1f</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;Date field or paired dropdowns work really well.&amp;nbsp; One of the key principals of good UX is to, where possible, make it extremely difficult for the end user to make a mistake.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72535?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 12:47:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e3e21a3c-0ffe-40ba-9a84-de1f05e64f66</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;Could you also use dropdown fields to limit their options? If you provide a dropdown for month and year right next to each other, a validation wouldn&amp;#39;t be necessary because you would only display months and years that are valid.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72534?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 12:44:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:96a31440-8a27-41e6-bb9c-a83a6c2af817</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;You add to yourself far greater work of avoiding months like 99, 55, AJ, RJ, GG, QQ, $%, **, or years like 1527, 1066, 9999, 4597, or &amp;quot;Spider-Man 2099&amp;quot; or &amp;quot;Steve Jobs&amp;#39; Birthday&amp;quot;.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s so much simpler to just use the component that&amp;#39;s already designed to prevent users from inputting anything other than a date.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72530?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 11:39:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6645c7d0-01c5-414b-8127-f03c65ee1c78</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Why not use an Appian Date field to capture a date type value, then extract the month and year from that?&amp;nbsp; This would keep you from having to use a lot of extra custom validation.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Doing this using text would be possible, but it would be frustrating and complicated.&amp;nbsp; Perhaps less complicated if you have the regex plugin and you&amp;#39;re already pretty familiar with how to use regex.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72529?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 11:17:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6b39740c-5900-42c4-b083-083fa41a87d3</guid><dc:creator>ST07</dc:creator><description>&lt;p&gt;hi mike , sorry for late reply , what if i want that the input text (string) is of MM/YYYY format ,&amp;nbsp; i am using validation on text filed. I have to extract only month and year and save them into db in mm/yyyy format&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72227?ContentTypeID=1</link><pubDate>Thu, 20 Feb 2020 13:09:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:065727d5-17bd-476e-9003-80885af2b913</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;In addition to &lt;em&gt;charat()&lt;/em&gt;, you might also check out the function &lt;em&gt;&lt;a href="https://docs.appian.com/suite/help/19.4/fnc_text_left.html"&gt;left()&lt;/a&gt;&lt;/em&gt;; left(&amp;quot;aces&amp;quot;, 2) would result &amp;quot;ac&amp;quot;, which should satisfy your use case.&amp;nbsp; I&amp;#39;ll post a more expansive code sample here, just to be thorough:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!textField(
  label: &amp;quot;My Text&amp;quot;,
  value: ri!textInput,
  saveInto: ri!textInput,
  validations: {
    if(
      upper(left(ri!textInput, 2)) = &amp;quot;AC&amp;quot;,
      null(),
      &amp;quot;Text must begin with the string &amp;#39;AC&amp;#39; (case insensitive).&amp;quot;
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: String validation</title><link>https://community.appian.com/thread/72224?ContentTypeID=1</link><pubDate>Thu, 20 Feb 2020 12:36:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8db72213-5345-45ad-a745-fd351dfebebb</guid><dc:creator>shwetad7106</dc:creator><description>&lt;p&gt;Hi &lt;a href="/members/shikhat0001"&gt;ST07&lt;/a&gt;, you can use function charat(text,index) to perform this validation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>