Click here to Skip to main content
15,886,860 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have many machines that send data through serial port in form of text which i recive it in multiline textbox.that data differ in their shape according to machine.my question how i extract the data from that text to store it in database.what the start step.is it have to trans to another format or i should too deal with it as it ?
i will give the data from 2 machines
1. the first
Quote:
<v>11201


<n>aspt<v>710







<sample>
<ver>1.1
<instrinfo>

<n>PRDI<v>BM800


<n>FIWV<v>2.6.7


<n>SNO<v>15535


<n>BRND<v>S


<n>IAPL<v>H


<n>IID


<n>LMOF<v>1



<smpinfo>

<n>ID<v>2


<n>SEQ<v>270


<n>DATE<v>2019-09-01T16:51:45


<n>OPID


<n>APNU<v>1


<n>APNA<v>BLOOD


<n>ASPM<v>OT


<n>ASPS<v>1


<n>SORC<v>0


<n>BLMD<v>0


<n>BLNK<v>0


<n>STYP<v>0


<n>RGED


<n>RGEL


<n>RGEC


<n>RDLI<v>1711-849


<n>RDPN<v>1123


<n>RDED<v>2020-11-22


<n>RLLI<v>1711-850


<n>RLPN<v>1696


<n>RLED<v>2020-11-19


<n>RCLI


<n>RCPN


<n>RCED


<n>RPD<rpds< n=""><v>0


<n>RPDL<v>15RCLI


<n>RCP


<n>RPDH<v>30


<n>RPDF<v>27


<n>MBTE<v>30.9


<n>MCVO<v>+0.0


<n>WDDM<v>0


<n>WDDP<v>45


<n>WDMS<v>2


<n>WDMA


<n>WDFB<v>0


<n>WDLL


<n>WDLH


<n>WDCL


<n>WDCH


<n>WLGL


<n>WLGH


<n>WDIL<v>140


<n>WDIH<v>180


<n>WDOM<v>0


<n>WDWD<v>2


<n>XLT


<n>CAPL


<n>CLVL


<n>CEXP


<n>CEXT


<n>EXCL


<n>ASWP



<smpresults>

<n>RBC<f>DP<l>3.50<h>5.50


<n>MCV<l>75.0<h>100.0


<n>HCT<l>35.0<h>55.0


<n>MCH<l>25.0<h>35.0


<n>MCHC<l>31.0<h>38.0


<n>RDWR<l>11.0<h>16.0


<n>RDWA<l>30.0<h>150.0


<n>PLT<f>DP<l>100n><l>8.0<h>11.0


<n>PC/n><l>30.0<h>150.0<t< n=""><l>0.01<h>9.99


<n>PDW<l>0.1<h>99.9


<n>LPCR<l>0.1<h>99.9


<n>HGB<f>DP<l>11.5<h>16.5


<n>WBC<f>DP<l>3.5<h>10.0


<n>LA<l>0.5<h>5.0


<n>MA<l>0.1<h>1.5


<n>GA<l>1.2<h>8.0


<n>LR<l>15.0<h>50.0


<n>MR<l>2.0<h>15.0


<n>GR<l>35.0<h>80.0



<tparams>

<n>RCT<v>14304


<n>WCT<v>11201


<n>aspt<v>710


<n>xfrt<v>1153


<n>acps<v>0


<n>asl1<v>0


<n>asl2<v>0


<n>rdmx<v>16


<n>rdmn<v>290


<n>rdbl<v>2048


<n>rrmn<v>1446


<n>rrmx<v>1865


<n>rrmd<v>1679


<n>rrdp<v>819


<n>rpds<v>132


<n>rpdt<v>952


<n>rpdd<v>119


<n>rpu/n><v>14304


<n>rput>rpdt<v>952


<n>rp<v>15962


<n>rpud<v>715


<n>rbrn<v>0


<n>rpdb<v>0


<n>rpdp<v>0


<n>rpdo<v>0


<n>rpub<v>0


<n>rpup<v>0


<n>rpu1<v>0


<n>rpu2<v>0


<n>rpuu<v>0


<n>wdmx<v>5


<n>wdmn<v>669


<n>wdbl<v>1024


<n>wrmn<v>617


<n>wrmx<v>748


<n>wrmd<v>679


<n>wrdp<v>893


<n>wpds<v>91


<n>wpdt<v>671


<n>wpdd<v>70


<n>wpus<v>1863


<n>wpua<v>11201


<n>wput<v>13064


<n>wpud<v>373


<n>wbrn<v>0


<n>wpdb<v>0


<n>wpdp<v>0


<n>wpdo<v>0


<n>wpub<v>0


<n>wpup<v>0


<n>wpu1<v>0


<n>wpu2<v>0


<n>wpuu<v>0


<n>dpds<v>88


<n>dpdd<v>0<2<v>0


<n>wpuu/p>

<n>dpus<v>2


<n>dput<v>3113


<n>dpud<v>0


<n>dpdb<v>0


<n>dpdp<v>1


<n>dpdo<v>0


<n>dpup<v>0


<n>dpuo<v>0


<n>dpuf<v>0


<n>ipds<v>202


<n>ipdt<v>4312


<n>ipdd<v>0


<n>ipus<v>225


<n>iput<v>4427


<n>ipud<v>0


<n>ipdb<v>0


<n>ipdp<v>0


<n>ipdo<v>0


<n>ipup<v>0


<n>ipuo<v>0


<n>ipuf<v>0


<n>lpds<v>151


<n>lpdt<v>4682


<n>lpdd<v>0


<n>lpus<v>325


<n>lput<v>8526


<n>lpud<v>0


<n>lpdb<v>0


<n>lpdp<v>0


<n>lpdo<v>0


<n>lpup<v>0


<n>lpuo<v>0


<n>hbfo<v>0


<n>hbft



<hgrams>



2.the 2nd machine
Quote:
IELite 3 2.8 20200902 13274142ANELite 3
Nour Al Eslam Laboratory






Serial No.: 960562
RecNo: 9547
Sample ID: 19537
Patient ID:
Patient Name:
Mode: Human
Doctor:
Age: 0 years
Birth(ymd): 00000000
Sex: -
Test date(ymd): 20200902
Test time(hm): 131900
Param Flags Value Unit [min-max]
WBC 7.34 10^3/Aµl [4.00-11.00]
LYM + 4.02 10^3/Aµl [1.30-4.00]
MON 0.29 10^3/Aµl [0.15-0.70]
GRA 3.03 10^3/Aµl [2.50-7.50]
LY% + 54.7 % [25.0-40.0]
MO% 3.9 % [ 3.0- 7.0]
GR% - 41.3 % [50.0-75.0]
RBC 4.55 10^6/Aµl [4.00-5.50]
HGB - 11.2 g/dl [12.0-17.4]
HCT - 34.09 % [36.00-52.00]
MCV - 75 fl [ 76- 96]
MCH - 24.6 pg [27.0-32.0]
MCHC 32.9 g/dl [30.0-35.0]
RDWc 15.5 % [ 0.0- 0.0]
RDWs + 46.9 fl [20.0-42.0]
PLT 251 10^3/Aµl [ 150- 400]
PCT 0.20 % [0.00-0.00]
MPV 8.1 fl [ 8.0-15.0]
PDWc 38.6 % [ 0.0- 0.0]
PDWs 11.4 fl [ 0.0- 0.0]
PLCC 62 10^3/Aµl [ 0- 0]
PLCR 24.66 % [0.00-0.00]
Flags:
WBC graph
Scale(fl): 400
Channels: 256
WMarker1: 11
WMarker2 40
WMarker3: 70
Points: 0 0 0 0 0 0 0 0 0 0 0 5 7 9 12 17 22 29 37 48 61 78 97 119 141 163 183 200 216 229 239 248 253 254 252 247 237 225 211 197 182 168 154 142 131 119 108 97 87 77 69 62 57 52 47 43 39 36 32 30 29 28 27 27 26 26 26 26 25 25 25 25 25 26 26 27 27 28 28 29 30 30 31 32 34 35 37 38 39 40 41 41 42 43 45 46 46 47 46 45 44 43 42 41 41 40 40 40 41 42 44 45 47 47 48 48 47 46 45 44 43 42 41 40 39 39 39 39 39 38 37 37 36 36 35 35 34 34 34 34 34 34 33 32 31 29 28 27 25 24 23 22 21 21 21 21 21 21 21 20 20 19 18 18 17 16 16 15 15 14 14 13 12 11 10 9 9 9 9 9 9 8 7 7 6 6 6 6 6 5 5 5 5 5 5 5 5 5 4 4 3 3 3 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0
RBC graph
Scale(fl): 200
Channels: 256
RMarker1: 33
Points: 4 8 13 21 29 37 44 48 50 49 48 44 41 37 33 29 24 21 18 16 13 12 10 8 7 6 5 5 4 4 4 3 3 3 2 2 2 2 2 2 2 2 2 2 3 4 4 4 5 5 6 7 9 11 12 15 19 22 27 31 36 41 47 53 60 67 76 85 94 104 115 126 137 149 162 174 185 196 206 216 225 233 241 246 250 252 253 254 254 254 253 250 245 239 231 223 214 206 199 191 182 173 164 155 146 138 131 123 116 108 102 95 90 84 79 74 69 65 61 58 55 52 48 45 43 40 38 37 36 34 33 32 31 30 30 29 28 27 26 26 24 24 23 22 22 21 20 20 20 20 19 19 18 17 15 14 13 12 12 11 11 11 11 11 11 11 10 10 9 9 8 8 7 7 7 6 6 6 6 5 5 4 4 4 4 3 3 3 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
PLT graph
Scale(fl): 50
Channels: 256
PMarker1: 11
PMarker2: 131
Points: 0 0 0 0 0 0 0 0 0 0 0 3 3 12 25 45 74 74 106 141 175 175 206 229 245 253 253 255 253 247 247 242 236 231 227 227 224 220 217 213 213 209 204 198 198 193 186 180 173 173 168 162 157 157 151 146 139 133 133 126 119 112 104 104 97 90 86 86 81 77 75 72 72 70 66 65 65 61 59 57 56 56 54 54 50 48 48 47 45 41 41 39 36 34 30 30 27 23 21 21 19 19 19 19 19 19 21 21 23 23 23 23 23 23 21 19 18 16 16 14 12 10 10 10 10 12 12 12 16 18 18 19 19 19 18 18 18 16 14 12 12 12 12 10 10 10 10 10 9 9 9 7 7 5 5 5 5 7 9 9 10 10 12 12 12 12 12 10 10 10 10 12 12 12 12 12 14 14 14 12 12 12 12 14 14 16 16 16 16 18 18 19 19 21 23 23 23 25 25 25 23 23 23 23 23 23 23 23 25 25 25 27 28 32 36 36 41 47 52 52 56 59 61 63 63 65 66 70 70 74 79 86 95 95 103 112 119 124 124 128 132 135 135 139 144 151 160 160 170 180 191 191 200 207 213 217
88


What I have tried:

i tied to deal with it as it but i think there as an easy way
Posted
Updated 4-Sep-19 1:30am
Comments
BillWoodruff 3-Sep-19 20:13pm    
It appears each of the two data streams are in a very different format. Do you have a way to recognize the formats ... or is that obvious given which machine you connect to ? Are these streams synchronous.

Do you have any control over how the streams are structured ?

1 solution

You have two alternatives
  1. put in the database the received data, as it stands.
  2. decode the received data and store in the database the extracted meaningful (for your application) info.


Alternative (1) is simple but hardly useful, without further processing. On the other hand, alternative (2) is harder to implement because you have to know the protocols used by the various machine.
Note we can only give you general help on such topics, in order to properly understand the different protocols you have to dive into the documentation.
 
Share this answer
 
Comments
Member 12673397 4-Sep-19 8:27am    
the second alternative the alternative of choice.which will arrange the data to be easy to manipulate it.the defecult maner is to extract the data from the text needs to well dealing with strin functions.
CPallini 4-Sep-19 12:07pm    
I believe .NET provides powerful tools for string manipulation.
Member 12673397 4-Sep-19 16:21pm    
sure my bro. wish me good luck

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900