5 Replies Latest reply on Aug 31, 2016 6:27 AM by Senta

# convert base10 to base 36

How can I convert base 10 to base 36 in landesk service desk?

• ###### 1. Re: convert base10 to base 36

Hello Himani,

The answer for this question will be similar to the one you asked in this thread How can I convert base36 to base10?

you can use a calculation to convert an integer to any base you like.

The result then has to be stored as a String, as Landesk does not have any attributes for Base36 numbers.

There is currently no ready-made calculation, so you (or a hired consultant) would need to create this calculation for you.

You (or your hired consultant) can use the libraries of .NET to ease the development work and use already present classes and functions as needed.

See Calculation Writing Tutorial - 5. Boo language features versus .NET classes on details how to do so.

• ###### 2. Re: convert base10 to base 36

Hi Jan,

Is there any sample code that you can provide me with? Do I need to include any library file also apart from import System?

• ###### 3. Re: convert base10 to base 36

Hello Himani,

the code needs to be developed by you or a hired consultant.

As said, you can use all .NET classes available in the Framework. Which ones you needs depends on the implementation of your code.

• ###### 4. Re: convert base10 to base 36

Hi,

I have written a code to convert Base36 to Base10, but it is not working.

I have created a field and added it on the window. The calculation is performed Before Save.

The code is:

import System

import System.Math

static def GetAttributeValue(Incident):

CharList = '34abcdef'

reversed = CharList.ToLower().Reverse()

result as long = 0

pos = 0

for c as char in reversed:

result += (CharList.IndexOf(c) * (Math.Pow(36, pos)))

pos += 1

return result

I am not able to use Reverse() as it states that 'Reverse is not a member of String'.

If I remove Reverse from the code then I am not able to view result on the field specified. How can I solve these issues? Please help me regarding the same.

• ###### 5. Re: convert base10 to base 36

Hello Mimani,

correct, Reverse is not a method of String in .NET.

Please check the documentation on String Class in .NET  String Class (System)

To reverse a String please use something along this lines

 Value = 'Test 1 2 3' Value2 = '' charArray = Value.ToCharArray() Array.Reverse(charArray) for c as char in charArray: Value2 += c return Value2