<?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>Convert base 10 to base 36 numbers using numbers 0 - 9 and letters A - Z</title><link>https://community.appian.com/discussions/f/general/13824/convert-base-10-to-base-36-numbers-using-numbers-0---9-and-letters-a---z</link><description>Hi all, 
 We are looking for a function that converts base 10 numbers to base 36 numbers (using numbers and letters to represent base 36 numbers), and also another function to convert base 36 text 
 Example1 - Convert base 10 to base 36 &amp;gt;&amp;gt; enter base</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Convert base 10 to base 36 numbers using numbers 0 - 9 and letters A - Z</title><link>https://community.appian.com/thread/62940?ContentTypeID=1</link><pubDate>Wed, 21 Nov 2018 18:35:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0341e9c5-0af3-4681-87ac-ca51b3052518</guid><dc:creator>nanfak</dc:creator><description>Thank you Mike Schmitt.&lt;br /&gt;
&lt;br /&gt;
We truly appreciate this.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Convert base 10 to base 36 numbers using numbers 0 - 9 and letters A - Z</title><link>https://community.appian.com/thread/62939?ContentTypeID=1</link><pubDate>Wed, 21 Nov 2018 18:14:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:74bf83d5-f088-4f52-b0fa-3a5dd895165b</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Also since it was bugging me, I went ahead and created the &amp;quot;convert back to base 10&amp;quot; expression rule, which takes any positive baseX value (between base 2 and base 36), along with the specific base in question.&amp;nbsp; Note it does minimal error handling but probably can&amp;#39;t handle extended corner cases.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-discussions-components-files/11/pastedimage1542827701801v1.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1542827701801v1.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(
  or(
    isnull(ri!xBaseNumberString),
    isnull(ri!base),
    ri!base &amp;gt; 36,
    ri!base &amp;lt; 2
  ),
  null(),
  
  with(
    local!charset: left(&amp;quot;0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;, ri!base),
    local!errorValue: -1,
    
    local!numCharacters: len(ri!xBaseNumberString),
    
    local!valueArray: a!forEach(
      items: reverse(enumerate(local!numCharacters)),
      
      expression: with(
        local!char: upper(ri!xBaseNumberString[fv!item + 1]),
        
        local!charPosition: find(local!char, local!charset),
        local!charValue: local!charPosition - 1,
        
        /* output: */
        if(
          local!charPosition = 0, /* try to handle the case of the number string having invalid characters */
          local!errorValue,
          local!charValue * (ri!base ^ (fv!index-1))
        )
      )
    ),
    
    if(
      contains(
        local!valueArray,
        local!errorValue
      ),
      tointeger(null()),
      sum(local!valueArray)
    )
    
    /* debug -- uncomment the following lines to see earlier calculated values */
    /*&amp;amp;char(10) &amp;amp; &amp;quot;numchars: &amp;quot; &amp;amp; local!numCharacters*/
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Convert base 10 to base 36 numbers using numbers 0 - 9 and letters A - Z</title><link>https://community.appian.com/thread/62935?ContentTypeID=1</link><pubDate>Wed, 21 Nov 2018 16:46:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7cc147e9-2041-4d75-8bb2-f50e8b69bd0e</guid><dc:creator>nanfak</dc:creator><description>Wow!!!&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Convert base 10 to base 36 numbers using numbers 0 - 9 and letters A - Z</title><link>https://community.appian.com/thread/62930?ContentTypeID=1</link><pubDate>Wed, 21 Nov 2018 14:44:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bb705558-5b7b-4ae9-bc44-446b9b2911ab</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;For anyone who&amp;#39;s interested, I was able to whip up this Appian expression rule last night, which uses 100% out-of-box functionality.&amp;nbsp; In it, a user can pass any valid integer, as well as any base (between 2 and 36), and get the resulting conversion in a string.&amp;nbsp; It performs fairly well, converting some of the largest allowable Appian integers into base 36 in only 2ms.&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-discussions-components-files/11/pastedimage1542815098324v1.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1542815098324v1.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(
  or(
    isnull(ri!base),
    isnull(ri!integer),
    ri!base &amp;gt; 36,
    ri!base &amp;lt; 2
  ),
  null(),
  
  with(
    local!base: ri!base,
    
    local!charset: left(&amp;quot;0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;, local!base),
    
    local!powerBase: log(ri!integer, local!base),
    local!numCharacters: ceiling(local!powerBase) + 1, /* the resulting number will need up to this many characters */
    
    
    local!strings: a!forEach(
      items: enumerate(local!numCharacters),
      
      expression: with(
        local!placeValue: ri!integer / (local!base ^ (fv!item)), /* requires zero-indexed list */
        
        local!charIndex: floor(mod(local!placeValue, local!base)),
        
        if(
          local!placeValue &amp;lt; 1,
          {},
          local!charset[local!charIndex+1]
        )
        
      )
    ),
    
    concat(reverse(local!strings))
    
    /* debug -- uncomment the following lines to see earlier calculated values */
    /*&amp;amp;char(10) &amp;amp; &amp;quot;power base: &amp;quot; &amp;amp; local!powerBase*/
    /*&amp;amp;char(10)&amp;amp; &amp;quot;places: &amp;quot; &amp;amp; local!numCharacters*/
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;To convert back from a given base to base10 would just require an expression rule that does the reverse of this, which IMHO would actually be easier (&lt;strong&gt;edit:&lt;/strong&gt; i&amp;#39;ve written this too and posted it below).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Convert base 10 to base 36 numbers using numbers 0 - 9 and letters A - Z</title><link>https://community.appian.com/thread/62887?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 15:11:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b57f77a8-ceeb-4f51-a994-3d86370ff336</guid><dc:creator>Mike Schmitt</dc:creator><description>To clarify a bit upon previous answers - this functionality would also be doable within an out-of-box expression rule if necessary, using normal internal Appian functions.  It probably wouldn&amp;#39;t perform 100% as well as a custom Java plug-in, but the advantage of doing it in an expression rule is that you could probably just write it yourself, using the expression language you already know, and without requiring plug-in hassles.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Convert base 10 to base 36 numbers using numbers 0 - 9 and letters A - Z</title><link>https://community.appian.com/thread/62857?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 07:36:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c58eb766-db6d-4c04-8f81-965cbe217cc9</guid><dc:creator>Roopesh Rambhatla</dc:creator><description>Most welcome .&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Convert base 10 to base 36 numbers using numbers 0 - 9 and letters A - Z</title><link>https://community.appian.com/thread/62856?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 07:34:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b8a3e4b9-0e7f-4b4a-9201-a144669b5364</guid><dc:creator>nanfak</dc:creator><description>Thanks Roopesh.  This was very helpful.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Convert base 10 to base 36 numbers using numbers 0 - 9 and letters A - Z</title><link>https://community.appian.com/thread/62843?ContentTypeID=1</link><pubDate>Mon, 19 Nov 2018 23:06:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dbf234b5-bb15-4372-8102-9a0c106e100c</guid><dc:creator>Roopesh Rambhatla</dc:creator><description>Hi Nanfak,&lt;br /&gt;
&lt;br /&gt;
You have to get the plugin deployed to your environment. If Your environment is running in Cloud than simply go to Admin console and click on Plugins , Post that click on Deploy new plugin and search for &amp;quot;Execute Stored Procedure&amp;quot;, and deploy same.&lt;br /&gt;
If you are running on-premise environment than download the jar from &lt;br /&gt;
&amp;quot;&lt;a href="https://forum.appian.com/suite/tempo/records/item/lMBCLGOdlMUpdGVqW3dQaIKmclBmvvNEj8vu_cjb7T-5YiPr4Fu8ly5Yj1s09uenE4RYzA8zKyx7eiUheKmLnNTW_hxoGu80lizWkOppif1oXwT9A/view/summary&amp;quot;"&gt;forum.appian.com/.../summary&amp;quot;&lt;/a&gt; and place the jar in the Plugin folder in the Server . It will take about a minute to get deployed.&lt;br /&gt;
&lt;br /&gt;
Once the plugin is deployed you can use below mentioned sample expression to call the Stored Proc in Appian.&lt;br /&gt;
&lt;br /&gt;
example :&lt;br /&gt;
&lt;br /&gt;
with(&lt;br /&gt;
local!base36raw:executestoredprocedure(&lt;br /&gt;
&amp;quot;java:/jdbc/Appian&amp;quot;,/*jndi Name can be found under the Data store or in Admin Console Dota Source */&lt;br /&gt;
  &amp;quot;Appian.convert_to_36&amp;quot;, /* format : schemaName.StoredProc Name */&lt;br /&gt;
  {&lt;br /&gt;
    {name: &amp;quot;numb&amp;quot;,value:3634 }&lt;br /&gt;
    &lt;br /&gt;
  }&lt;br /&gt;
),&lt;br /&gt;
local!base36value:index(local!base36raw.result,&amp;quot;conv(numb,10,36)&amp;quot;,null),&lt;br /&gt;
local!base36value&lt;br /&gt;
)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Convert base 10 to base 36 numbers using numbers 0 - 9 and letters A - Z</title><link>https://community.appian.com/thread/62807?ContentTypeID=1</link><pubDate>Mon, 19 Nov 2018 12:50:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:17847a17-4ef9-43f4-9246-347911a55eb6</guid><dc:creator>nanfak</dc:creator><description>Thanks again Roopesh.  How will I call this stored procedure in an expression rule?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Convert base 10 to base 36 numbers using numbers 0 - 9 and letters A - Z</title><link>https://community.appian.com/thread/62785?ContentTypeID=1</link><pubDate>Mon, 19 Nov 2018 05:35:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7fe5dd1c-d172-43f5-81dd-88938e0d91ed</guid><dc:creator>nanfak</dc:creator><description>Thanks!&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Convert base 10 to base 36 numbers using numbers 0 - 9 and letters A - Z</title><link>https://community.appian.com/thread/62771?ContentTypeID=1</link><pubDate>Mon, 19 Nov 2018 02:00:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5d860360-81c1-4002-9654-8a409d2c488a</guid><dc:creator>Roopesh Rambhatla</dc:creator><description>Hi nanfak,&lt;br /&gt;
&lt;br /&gt;
There is an alternative, if your are using MySQL than there is function &amp;quot;select conv(&amp;#39;3634&amp;#39;,10,36)&amp;quot; which does the trick. so you can implement the solution using triggers, stored procedures or views.  &lt;br /&gt;
Example :  stored Proc Solution&lt;br /&gt;
&lt;br /&gt;
DELIMITER //&lt;br /&gt;
CREATE PROCEDURE convert_to_36&lt;br /&gt;
(IN numb int)&lt;br /&gt;
BEGIN&lt;br /&gt;
  select conv(numb,10,36);&lt;br /&gt;
END //&lt;br /&gt;
DELIMITER ;&lt;br /&gt;
&lt;br /&gt;
Call call convert_to_36(3634)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can do similar to convert from base 36 to base 10. Appian has a function which call the stored Procs in an Expression rule. &lt;br /&gt;
&lt;br /&gt;
Hopefully it works for you.&lt;br /&gt;
&lt;br /&gt;
Thanks Roopesh&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Convert base 10 to base 36 numbers using numbers 0 - 9 and letters A - Z</title><link>https://community.appian.com/thread/62770?ContentTypeID=1</link><pubDate>Mon, 19 Nov 2018 01:52:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6d85a3c7-dbc5-483d-bbdb-8b85956e881b</guid><dc:creator>aloks0189</dc:creator><description>Hi &lt;a href="/members/nanfak"&gt;nanfak&lt;/a&gt; as per my understanding, we do not have any such functions available OOTB in Appian.&lt;br /&gt;
&lt;br /&gt;
Hence i believe you need to build a Custom Plug-in (Expression Function) using java code, in order to achieve this requirement.&lt;br /&gt;
&lt;br /&gt;
Hope this will help.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>