Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

ASCII to text conversion

I have an SQL  database field, having value in ASCII format, how to show that text in readable format in qvw??

Sample value:

0C01000000A0DEB76FCDE7D54EB64EBC85E527D561000000000000000001000000

1 Solution

Accepted Solutions
whiteline
Master II
Master II

I know I said.

I don't now the format of your string.

According to ASCII table your text is something like ' Ю·oНзХN¶Nј…е'Хa'.

The script returns an empty string because there are zeros wich means 'end of string'.

View solution in original post

5 Replies
whiteline
Master II
Master II

You can write a maco function that converts ASCII string into text string.

Then you can simply use it in the load script.

Not applicable
Author

Can you help me in writing macro?

whiteline
Master II
Master II

I don't now the format of your string.

I writed a sample for a simple byte ASCII encoding (for example 596F752063616E20646F206974).

Macro:

function ASCIIToText (str)

      Dim result, x

      ASCIIToText = ""

      If Len(str)<2 Then Exit Function

      If Len(str)=2 Then

           ASCIIToText = Chr(CByte("&h" & str))

           Exit Function

      End If

      result = ""

      For x=1 To Len(str) Step 2

           result = result & ASCIIToText(Mid(str, x, 2))

      Next

      ASCIIToText = result

End function

Now in the load script you can use ASCIIToText as any other function:

LOAD

      ASCIIToText(ASCIIValue) as TextValue

Resident SomeTableWithASCIIData;

Not applicable
Author

This macro is giving me null.. do you have any idea why??

Can you test your macro with the sample data i provided above please

whiteline
Master II
Master II

I know I said.

I don't now the format of your string.

According to ASCII table your text is something like ' Ю·oНзХN¶Nј…е'Хa'.

The script returns an empty string because there are zeros wich means 'end of string'.