LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any way of stopping labview from autoconverting hex data from an SQL database to ascii?

Solved!
Go to solution

Hello all,

I'm currently working on a program that query's an SQL database for sensor data and converts that data to a spreadsheet for future use.

My problem is as follows:
I can access and read the database just fine; however, the data I'm after is stored in the database as a hex number (example: "0X5727000....". When I pass this through this "DB Tools Fetch Element Data" vi, it grabs the data and autoconverts it to ascii. This is a huge problem as the data contains several pieces of information and needs to be parsed before it's converted in order to attain the correct value (and ascii's the wrong format anyway).


Is there any way to grab the data as a string containing just the hex information? I already have code that converts it; I just need it as the hex values and not the ascii it's trying to autoformat it to.

0 Kudos
Message 1 of 16
(4,261 Views)

Wire a string to the type terminal

0 Kudos
Message 2 of 16
(4,256 Views)

Did not work. Returns " W'      ..." Instead of "0x5..."

I wish to continue using this function as the DB I'm reading is going to have data being written to it as I'm reading. I see a possible solution with an alternative (dB tool sselect data -> Database Variant to data), but that will slow down the program immensely as the dB gets larger.

0 Kudos
Message 3 of 16
(4,247 Views)

Just tried what I mentioned in the last post, did not solve the problem. It still outputs "W'   ♦..." instead of the data I want.

0 Kudos
Message 4 of 16
(4,244 Views)

Attach an example of how the data looks in the database.  Attach how it shows up in LabVIEW.

 

saying 0x5... isn't very helpful, that is only one hexadecimal digit.  The letter "W" is x57.  So I'm wondering if that is that you are seeing.  But you didn't give enough detail.

 

My guess is that you just aren't selecting the correct display style.  Set the display style for that string to be in Hex Display.

0 Kudos
Message 5 of 16
(4,239 Views)

What happens if you set the type input string to display as Hex?  This may cause the output of the VI to also output Hex. 

aputman
0 Kudos
Message 6 of 16
(4,234 Views)

Attached pictures.

I wasn't being specific as specifics really don't buy anything, but if it helps explain what the problem is, why not?

Hex display doesn't really fix the issue either (I tried that. Included a picture if you wanna see), plus labview won't use the Hex Display format to do further work on the string anyway.

0 Kudos
Message 7 of 16
(4,231 Views)
Solution
Accepted by topic author Scei

Your data is definitely binary.  And how it is stored in the database is a function of whatever program put it in there.  It is not a case of LabVIEW doing any "autoconverting".

 

"plus labview won't use the Hex Display format to do further work on the string anyway"

 

So the next question is what is the further work you want to do on this data?  There is a function call "String to Byte Array" that converts the characters to an array of U8's.  So now you have an array of U8 numbers.  What you do next with that depends on what all of this data is supposed to represent.

 

 

 

 

Message 8 of 16
(4,209 Views)

OK...in the select data VI, use the convert command....similar to this.

Capture.PNG

aputman
0 Kudos
Message 9 of 16
(4,206 Views)

Actually, that will not do what you are asking.  

aputman
0 Kudos
Message 10 of 16
(4,200 Views)