How can I change an integer to Hex in Attain 3.60?

benmann
Member Posts: 8
Hi, I am trying to get a hexidecimal representation of an integer in Attain 3.60 as part of a checksum routine to validate some files that I'm importing.
Does anyone know if there is a way to do this within Attain?
If not, I guess I could write a routine to do it...
Thanks.
Does anyone know if there is a way to do this within Attain?
If not, I guess I could write a routine to do it...
Thanks.
0
Comments
-
Try this code:
Vars: txtDigits Text 30 txtHex Text 30 intInteger Integer intValue Integer MESSAGE(fctInt2Hex(1000)); MESSAGE(FORMAT(fctHex2Int('3E8'))); fctInt2Hex(pInt : Integer) : Text[30] txtDigits := '0123456789ABCDEF'; txtHex := ''; REPEAT txtHex := COPYSTR(txtDigits,(pInt MOD 16) + 1,1) + txtHex; pInt := (pInt - (pInt MOD 16)) / 16; UNTIL pInt = 0; EXIT(txtHex); fctHex2Int(pText : Text[30]) : Integer txtDigits := '0123456789ABCDEF'; intInteger := 0; WHILE pText <> '' DO BEGIN intInteger := intInteger * 16; intValue := STRPOS(txtDigits,COPYSTR(pText,1,1)) - 1; intInteger := intInteger + intValue; pText := COPYSTR(pText,2); END; EXIT(intInteger);
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
Thanks,
I'll try it out on Monday as I've been away from the office today.0 -
Luc, you are one *** of a hacker.. :shock:
me impressedDid I commit today?0 -
Yes, that solved the problem.
Thanks Luc.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions