Convert base 10 to base 36 numbers using numbers 0 - 9 and letters A - Z

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 >> enter base 10 number int(3634) and get base 36 text string "2SY"

Example2 - Convert base 36 to base 10 >> enter base 36 text string("A2J") and get base 10 number int 13051

Does anyone have an idea where we can start from?

Thanks

  Discussion posts and replies are publicly visible

Parents
  • Hi nanfak,

    There is an alternative, if your are using MySQL than there is function "select conv('3634',10,36)" which does the trick. so you can implement the solution using triggers, stored procedures or views.
    Example : stored Proc Solution

    DELIMITER //
    CREATE PROCEDURE convert_to_36
    (IN numb int)
    BEGIN
    select conv(numb,10,36);
    END //
    DELIMITER ;

    Call call convert_to_36(3634)


    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.

    Hopefully it works for you.

    Thanks Roopesh
  • Thanks again Roopesh. How will I call this stored procedure in an expression rule?
  • +1
    Certified Lead Developer
    in reply to nanfak
    Hi Nanfak,

    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 "Execute Stored Procedure", and deploy same.
    If you are running on-premise environment than download the jar from
    "forum.appian.com/.../summary" and place the jar in the Plugin folder in the Server . It will take about a minute to get deployed.

    Once the plugin is deployed you can use below mentioned sample expression to call the Stored Proc in Appian.

    example :

    with(
    local!base36raw:executestoredprocedure(
    "java:/jdbc/Appian",/*jndi Name can be found under the Data store or in Admin Console Dota Source */
    "Appian.convert_to_36", /* format : schemaName.StoredProc Name */
    {
    {name: "numb",value:3634 }

    }
    ),
    local!base36value:index(local!base36raw.result,"conv(numb,10,36)",null),
    local!base36value
    )
Reply
  • +1
    Certified Lead Developer
    in reply to nanfak
    Hi Nanfak,

    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 "Execute Stored Procedure", and deploy same.
    If you are running on-premise environment than download the jar from
    "forum.appian.com/.../summary" and place the jar in the Plugin folder in the Server . It will take about a minute to get deployed.

    Once the plugin is deployed you can use below mentioned sample expression to call the Stored Proc in Appian.

    example :

    with(
    local!base36raw:executestoredprocedure(
    "java:/jdbc/Appian",/*jndi Name can be found under the Data store or in Admin Console Dota Source */
    "Appian.convert_to_36", /* format : schemaName.StoredProc Name */
    {
    {name: "numb",value:3634 }

    }
    ),
    local!base36value:index(local!base36raw.result,"conv(numb,10,36)",null),
    local!base36value
    )
Children