function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
praveen murugesanpraveen murugesan 

How to convert the Hexa Decimal value into Byte code?

In my object there are totally three fieds Value__c,Hexa__c,Bytevalue_c.

Value__c- User input(textfield).

Hexa__c- Hexa Decimal of A (text field used trigger to convert string to hexa decimal).

Bytevalue__c In this field I need to save the byte code of the Hexa Decimal value.

 

Sample Input:

 

Value__c -- 'A'

 

Hexa__c- '6dcd4ce23d88e2ee9568ba546c007c63d9131c1b'

 

Now I need to convert Hexa__c to bytecode. So I have used IF ladder for Substitute but it is not working. 

 

if(contains(Encrypted__c,'a') ,
SUBSTITUTE(Encrypted__c, 'a', '1010' ),

if( contains(Encrypted__c,'b') ,
SUBSTITUTE(Encrypted__c, 'b', '1011' ),

if(contains(Encrypted__c,'c') ,
SUBSTITUTE(Encrypted__c, 'c', '1010' ),

if( contains(Encrypted__c,'d') ,
SUBSTITUTE(Encrypted__c, 'd', '1011' ),

if(contains(Encrypted__c,'e') ,
SUBSTITUTE(Encrypted__c, 'e', '1010' ),

if( contains(Encrypted__c,'f') ,
SUBSTITUTE(Encrypted__c, 'f', '1011' ),

SUBSTITUTE(Encrypted__c, 'c', '1011')

)
)
)
)
)
)

 

 

Help me to do this.. Thanks..

 

 

 

Vinita_SFDCVinita_SFDC

Hello Praveen,

 

Please refer the following link which has multiple code snippets for this requirement:

 

http://boards.developerforce.com/t5/Apex-Code-Development/Method-to-convert-Hex-to-String-or-blob/td-p/187747

 

Hope this helps!