LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract individual TCP Packet values?

Solved!
Go to solution

Hi to all!

Im dealing with a situation where i need to extract individual values in order to insert into a sql database.

Im sucessfully receiving the packet, and the values i need to insert are between { xxxxxxxxxxxxxxxx }, each value name (column name) is delimited between "xxxxxxxx", and also its value.

im pasting the packet received:

 

{ "Address" : "0xC800A8C0", "Channel" : 0, "Descrip" : "DDNS", "Event" : "Update", "SerialID" : "000b3d016ce3", "StartTime" : "2011-12-01 20:04:51", "Status" : "Start", "Type" : "Log" }

 

how can i extract column names and values from the string received?

for example: "Address" : "0cC800A8C0" -------------- the column name is Address and the value is 0cC800A8C0, etc, etc... each field is separated with a "," and each row is delimited between { }

i need to insert only 0cC800A8C0 in Address column (and all the other values), but without " " and without : ... please note that Channel : 0 , the 0 does not have "" because its a numeric value, the rest are strings.

any help on this?

 

thanks in advance!

0 Kudos
Message 1 of 5
(3,260 Views)

Give this a try. This will separate the data into a 2D array with the first column containing the column name and the second column containing the data. If you need to process multiple rows in one string you will need to wrap this code in another loop that will extract each data row.

 

DB Parser.png



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 5
(3,256 Views)

thanks mark!

can you please attach it in LV 10.0 format as it is in 11.0 and i have 10.0

 

thanks!

0 Kudos
Message 3 of 5
(3,252 Views)
Solution
Accepted by nickpuy

Here you go.

 



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 5
(3,250 Views)

thank you very much!

0 Kudos
Message 5 of 5
(3,241 Views)