Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

NumToDuoTrigesimal ( number )

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 4.7  (32 votes)
  Discuss this Custom Function

Tim Griffith, None
None

Converts a number into a duotrigesimal (base32) string

Sample Input:
NumToDuoTrigesimal ( 123456789 )
Sample Output:
3NQK8N


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

NumToDuoTrigesimal ( number )

No dependencies

( to convert Duotrigesimal strings back to numbers use custom function DuoTrigesimalToNum ( DTGString ) )

Created: December 26, 2010 St. Louis, MO USA

Tim Griffith Sr.

Duotrigesimal, or base 32 numbers are like Hexadecimal numbers in that after 9, numbers are represented by letters. We know we can't use all the letters of the alphabet because the index of numbers would go beyond 31 up to 35. As best I have discovered the letters 'I' 'L' and 'O' are not used because in various forms they can be mistaken for other characters. My research has also shown that the letter 'U' has been omited because of 'accidental obscenities'.
Throughout books and the internet there are numerous algorithms showing how to convert numbers to hex and hex to numbers. I am not a genius, but rather a bit clever enough to augment those formulas to add the additional letters beyong hex F, and substitute dividing or multplying 16 into 32. All in all it was quite simple.
If credit is due- then it is due to those many people who have provided hex to num formulas. Thank you all- you know who you are!

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it

Discuss:

You could make it more portable (easy to change the allowed character set and quantity) by not hard-coding the number of characters in your base. Just do the following:

Let ( [
_ALPH = "0123456789ABCDEFGHJKMNPQRSTVWXYZ" ;
_BASE = Mod ( number ; Length( _ALPH ) ) ;
_CHAR = Middle ( _ALPH ; _BASE + 1 ; 1 ) ;
_NEXT = Div ( number ; Length( _ALPH ) )
] ;

Case (
_NEXT ;
NumToDuoTrigesimal ( _NEXT )
)//end Case
& _CHAR
)//end Let

Or to make it incredibly portable, make the "base string" (your _ALPH variable) be a parameter, and name the function BaseConvert( baseString, decimalNumber ).

Daniel A. Shockley, New York, NY
January 13, 2011 11:25am

Where baseString is used instead of _ALPH in the custom function, and decimalNumber is used instead of number to make it clear that the number must be in decimal, not some other custom base).

Daniel A. Shockley, New York, NY
January 13, 2011 11:27am

Thanks Daniel, very inspired thinking on your part- I should have seen this- but I was so connected to the idea of of a cf for for base 32 that I missed the logic of the simpler solution. I am going to work this and post it.

Tim Griffith, St. Louis, MO USA
January 13, 2011 1:34pm

Daniel, OK, the conversion you noted from number to BASEx was very easy indeed- just as you stated. However, converting back from a BASEx presents lots of extra programmed reasoning- in that, allowing the user to create any BASE system, you will end up with letters in positions that will have to be calculated, ie. A will not always be the 10th character etc. Plus, a user BASE might also allow juxtaposing alpha and numeric, such as character set = 01BFT74K983D5. Sure this can be worked out, but not as elegantly as just dealing with an accepted standard base system.
So, to create a custom BASEx conversion-- follow Daniels inspired observations. I tried it, it worked well. As far as a reverse conversion- I'll let another wise person out there figure it out. I think there is already an 'any base' cf on the list, so there might also be the reverse conversion there also. I am currently very busy with an HL7 parser.

Tim Griffith, St. Louis
January 13, 2011 5:17pm

Tim, we ended up adapting your original function to allow for any base conversion ( BaseX_FromDecimal: https://www.briandunning.com/cf/2051 ). I also created a function to allow for conversion back to decimal, provided the same baseString is used ( BaseX_ToDecimal: https://www.briandunning.com/cf/2052 ).

Erik Shagdar, New York, NY
June 20, 2017 9:38am

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 1 + 4 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. decFromHex ( hexValue )
  (Mon, Oct 16, 12:34pm)
2. MonthYearList ( startmonth ; startyear ; numbermonth ; short )
  (Mon, Oct 16, 3:38am)
3. ErrorDescription ( errorNumber )
  (Wed, Sep 27, 2:51am)
4. decodeEntities (text)
  (Wed, Sep 27, 1:22am)
5. HexidecimalToNumber ( HexidecimalValue ; counter )
  (Mon, Sep 25, 12:39pm)
6. FixedFieldConverter ( Fieldname ; f1 ; f2 ; f3 ; f4 ; f5 ; f6 ; f7 ; f8 ; f9 ; f10 ; f11 ; f12 ; f13 ; f14 ; f15 ; f16 ; f17 ; f18 ; f1
  (Fri, Sep 15, 12:34pm)
7. ShannonEntropy ( text )
  (Thu, Sep 07, 5:59am)
8. LetterCount ( text ; summary )
  (Thu, Sep 07, 5:53am)

RSS Feed of Custom Functions