<?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>toInteger() parameters</title><link>https://community.appian.com/discussions/f/general/11484/tointeger-parameters</link><description>Hello! 
 I&amp;#39;m very surprised when I put toInteger(&amp;quot;ab7cde?z2n7k&amp;quot;) and got 727 as a result. From my point of view it is not an integer at all.</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/51830?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2018 08:35:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:08bc1377-59dd-4011-bc1c-0e37a737b54e</guid><dc:creator>lokeshk822</dc:creator><description>yes, I agree with you Bhushan&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/51829?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2018 08:00:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:27680126-f5cc-4c9d-b6b0-fa5596657ec2</guid><dc:creator>sergeiz</dc:creator><description>I was trying to perform some input validations. Some incoming data was incorrect integers but failed in other place. I solved my case with cleanwith function allowing digits only. Which is ok for my case, but not for general as general case can have plus/minus sign in the leading position.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/51780?ContentTypeID=1</link><pubDate>Tue, 16 Jan 2018 14:07:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bc94dd23-4186-4261-8b85-4f83e296b832</guid><dc:creator>Issam Dabaie</dc:creator><description>What were you trying to accomplish using tointeger() on a field containing letters and symbols?  Perhaps an alternate solution can be determined.&lt;br /&gt;
&lt;br /&gt;
As others have said, tointeger() will strip any non-integers from the input.  In this case, 727 are the only integers.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/51747?ContentTypeID=1</link><pubDate>Mon, 15 Jan 2018 08:13:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ab13e0b4-ed14-4644-890b-b0bc51cb2330</guid><dc:creator>sergeiz</dc:creator><description>JavaScript returns NaN if the string starts with not digit character, &amp;quot;a1&amp;quot;, for example. Appian therefore is even more relaxed than JavaScript.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/51724?ContentTypeID=1</link><pubDate>Fri, 12 Jan 2018 21:32:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dbf7d4bc-405b-4855-bb4a-5d884270126c</guid><dc:creator>jayakumars</dc:creator><description>&lt;p&gt;Yea, Appian implements a toInteger() in a very similar way to JavaScript, where all non-integer characters are stripped, and the remaining are used to create the integer. &lt;a href="https://www.w3schools.com/jsref/jsref_parseint.asp"&gt;www.w3schools.com/.../jsref_parseint.asp&lt;/a&gt;&lt;br /&gt; &lt;br /&gt; It&amp;#39;s important to note here, that Appian&amp;#39;s toInteger() does not convert strings that representation of numbers in a different base (such as hexadecimal). &amp;quot;0x10&amp;quot; will convert to 10 (010, drop the leading 0), and not 16 (which is decimal representation of hexadecimal number 10).&lt;br /&gt; &lt;br /&gt; As you must ensure the input from your users is indeed a integer number, I agree, you cannot rely on toInteger, or an integerField. I would recommend using a textField to gather the end user input, and placing a validation to ensure they input an integer. A very quick thought would be to compare the length of the input string, with the length of the toString(toInteger( input string) ). If they are the same, you know the user entered a valid integer. See below code snippet as a quick example for this comparison.&lt;br /&gt; &lt;br /&gt; load(&lt;br /&gt; local!data: &amp;quot;m2&amp;quot;,&lt;br /&gt; len(&lt;br /&gt; toInteger(&lt;br /&gt; local!data&lt;br /&gt; )&lt;br /&gt; ) = len(&lt;br /&gt; tostring(&lt;br /&gt; local!data&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; &lt;br /&gt; Since toInteger strips the &amp;#39;m&amp;#39; from our data, the lengths will not be the same. Representing that local!data was not composed of only integers. This will return false if the data is a decimal and not an integer.&amp;nbsp; (Wanted to expand a bit on my previous comment)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/51717?ContentTypeID=1</link><pubDate>Fri, 12 Jan 2018 21:15:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f212b8ff-73ee-433f-9c36-cd93efd3aafb</guid><dc:creator>sergeiz</dc:creator><description>You probably missed the non-digit characters which are not in line with most languages. Also two dots make a string incorrect decimal number.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/51714?ContentTypeID=1</link><pubDate>Fri, 12 Jan 2018 21:07:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:243ec51b-71f7-43b9-8021-0f24c5d103f3</guid><dc:creator>jayakumars</dc:creator><description>This is pretty in line with most languages that implement integer as well, where the decimal points are cut off / truncated.  I believe Java behaves this way as well.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50577?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 19:14:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:de25e9f4-7c3f-4095-a36a-68d787a5b0b7</guid><dc:creator>sergeiz</dc:creator><description>&lt;p&gt;I solved the case by cleanwith(). But the issue still exists. toInteger() function allows incorrect input which is terrible.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50576?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 19:12:29 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6194d429-7608-47f2-a9d4-66fcf356e279</guid><dc:creator>Colton Beck</dc:creator><description>Can you handle this up front by validating that the input string contains a valid number, or by stripping non-numerical characters in the form field?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50575?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 19:06:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8cb953bd-702b-4253-8435-ba90e276f1ba</guid><dc:creator>sergeiz</dc:creator><description>I need to have some calculations based on digits of input string. In my case toInteger(&amp;quot;a&amp;quot;) returns null where as toInteger(&amp;quot;a1b&amp;quot;) returns 1 which is nonsense as &amp;quot;a1a&amp;quot; is not an integer. In the documentation we have &amp;quot;Values passed must remain within the limits of the Integer data type.&amp;quot; which is not true. This &amp;quot;must&amp;quot; is not validated within the implementation and I cannot not rely on this.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50574?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 18:25:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:37a8899c-c2f2-43d4-b757-ee5fb4f128de</guid><dc:creator>saboulnaga</dc:creator><description>I agree with coltonb , is there a particular reason you&amp;#39;re doing this? I fail to see the point of this example.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50573?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 18:22:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ce40eef2-9fd4-43ce-b838-4d361aa51fde</guid><dc:creator>thomasf</dc:creator><description>Correct, it is not a number.  Decimals only have one period, so when they are passed into the toInteger() function they are rounded down, or - as you said - the digits after the point are cut.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50572?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 18:20:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ee583717-de5b-42bc-ab67-65ffd243cac5</guid><dc:creator>Colton Beck</dc:creator><description>Is there a particular use case for tointeger() that&amp;#39;s causing you trouble, or are you just curious about its functionality?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50571?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 18:18:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b1cb644c-c718-4abf-80a9-a9afb7757e9e</guid><dc:creator>sergeiz</dc:creator><description>Is it rounding down? &amp;quot;1.9.3&amp;quot; is not a number.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50570?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 18:15:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:465953ab-7cb0-4f72-8bcc-c4f8d07363b9</guid><dc:creator>thomasf</dc:creator><description>It should return 1.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50569?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 18:13:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d877028d-0e81-47b0-ad6d-77788b2450ee</guid><dc:creator>sergeiz</dc:creator><description>It&amp;#39;s not actually rounding down. What will you get from &amp;quot;1.9.3&amp;quot;?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50568?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 18:10:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f7838130-f6ac-481d-8266-9fc8cca3ed4f</guid><dc:creator>thomasf</dc:creator><description>Yes, they are rounded down - or cut - 2.4 becomes 2, 3.999812 becomes 3, 45.1 becomes 45, etc.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50567?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 18:07:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a8067efa-f17f-4527-8376-5e28be2668fc</guid><dc:creator>sergeiz</dc:creator><description>Why non-numeric will be removed? Decimals will be cut, not rounded.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50565?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 17:41:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4d767ba2-f0a7-4e97-89c0-d2b54d35599e</guid><dc:creator>thomasf</dc:creator><description>&lt;p&gt;Non-numeric characters will be removed and any decimals will be rounded down.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50564?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 16:18:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6903d73b-fa01-4dd4-bd7f-7b4ab34c07ac</guid><dc:creator>sergeiz</dc:creator><description>The strange thing is that it is not written in the documentation.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50562?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 15:56:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4fd57128-a87a-42cf-8b58-21ae5e4b3195</guid><dc:creator>bhushanc</dc:creator><description>When converting a string to integer in Appian, tointeger() strips all the non numeric characters from the string and them returns only the numeric characters and casts it into a numeric data type. &lt;br /&gt;
&lt;br /&gt;
for Example: if you have an array of String {&amp;quot;sdfv1254s5dfv&amp;quot;, &amp;quot;15dfv125svd&amp;quot;}&lt;br /&gt;
using an tointeger() on this will return an array of integers &lt;br /&gt;
&lt;br /&gt;
Expression: tointeger({&amp;quot;sdfv1254s5dfv&amp;quot;, &amp;quot;15dfv125svd&amp;quot;})&lt;br /&gt;
Output: &lt;br /&gt;
Type: List of Number (Integer) &lt;br /&gt;
Output: {12545,15125}&lt;br /&gt;
&lt;br /&gt;
and if you want to verify if a type of input then you can use typename(typeof(&amp;quot;ab7cde?z2n7k&amp;quot;)) this will return text&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50556?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 14:16:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f0c731e6-f78f-4255-b48d-913674c29359</guid><dc:creator>Puspendu Pal</dc:creator><description>Hello,&lt;br /&gt;
&lt;br /&gt;
toInteger() works the way you havedescribed. It tries to convert the string into integer and while doing so.. it strips the non-digits.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toInteger() parameters</title><link>https://community.appian.com/thread/50554?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 14:12:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f44cc583-2adc-4561-bc7b-4e7addab8b87</guid><dc:creator>Colton Beck</dc:creator><description>It appears to be stripping the text characters out and only returning the result for the numerical characters within quotes, 7 - 2 - 7&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>