infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Cloverleaf
Base64 encoding in an xlate
RICK L. PRITCHETT
Is there any way to do base64 ending in an xlate? If I remember correctly there is a package required to do this.
Find more posts tagged with
Clovertech
Comments
Jeff Dinsmore
I've never done this specifically, but you could try something like this in an Xlate copy Tcl snippet:
package require base64
set str [lindex $xlateInVals 0]
set xlateOutVals [list [base64::encode $str]]
Peter Heggie
yes there is a package
ex: package require base64
This would un-encode a base64 value:
set code [catch {base64::decode "$base64string"} output1]
Are you un-encoding a base64 string in OBX.5 ?
Jim Kosloskey
Yes, you can and like Jeff indicates you need to require the base64 package.
I do the following (using Jeff's example):
set msg_data_encoded [base64::encode $str]
set xlateOutVals [lreplace $xlateOutVals 0 0 $msg_data_encoded]
BUT - if you are encoding the data in sructured message (HL/7, X12, etc.), what if encoding characters (HL/7 '| ^ ~, etc') are in the data to be encoded? It is possible the inbound may not parse out correctly.
Jim
Jeff Dinsmore
Wow, re-reading my post, I see I did a pretty bad job checking my work...
It should read something like this:
package require base64
set str [lindex $xlateInVals 0]
set xlateOutVals [list [base64::encode $str]]
Jeff Dinsmore
... and now I see that it wasn't me... seems my coding confused the editor somehow.
my response was substantially like Jim's, so we'll just leave it at that.
Jim Kosloskey
Jeff, I bet it is your keyboard. For over 55 years I have not had one keyboard that can spell or convey my thoughts properly :-)
Jeff Dinsmore
Yep, it's definitely busted.
It's also getting more apathetic as it gets older.
I'll requisition a new one.
RobertKersemakers
Regarding possible (HL7) encoding characters in base64.
Base64 encodes into a-z, A-Z, 0-9, "+" and "/". So no HL7 encoding characters, which means you can safely use a base64 encoded string inside a (normal) HL7 message.
EDIFact would have problems with this as + is a reserved character. Other structered messages may have problems with this as well.