Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Major Headache, Parsing with Partial data

Status
Not open for further replies.

Karl Blessing

Programmer
Feb 25, 2000
2,936
US
I have a project, where they want to see the data as it comes in I have a String that come I'll try to explain it the best I can, the data string can be split up there are Groups, all groups contain the initial Column, alignment, etc as the first group, but may contain different data and Totals.<br><br>Group1`Group2`Group3`<br><br>those are &quot;major' delimiters<br><br>within group 1 we have<br><br>AutoSizeInfo~ColumnInfo~Data~InsertedTotals<br><br>only group one will contain 4 subpeices between ~<br><br>then autosize is either &quot;1&quot; or &quot;0&quot;<br>ColumnInfo is<br>Name^Width^DA^...<br>The First 2 peices of Sections with ~ dont have to be defined here since, once I get the String in between the ~ I can just pass them to the function, because the GrpInfo I <b>Must</b> have completely, however here's where it gets tricky, The Data Portion is seperated like so<br><br>Colum1Data^Colum2Data^Colum3Data¦Colum1Data(row2)^Colum2Data(row2)^Colum3Data(row2)....<br><br>but they want to see the data on the listview as it comes in, so I cant wait til I have the ~ at the end(end of data) I have to then Search for each &quot;¦&quot; then Add the row for that peice.<br><br>any group after the first is<br><br>Data~InsertedTotals<br><br>so it's just two after first group, my problem is that, if I havent already done the First two sections of Group one, I need to make sure those are down, then I continue and grab each section for Data, then move to group two, the idea seems simple enough but I'm having a horrible time with Instr, and Splitting and trying to get the loop to check and see if the new section is data, or if I need to wait for next loop around to get whatever, it's become a real pain JUST because they want to see it come in every say 10 or 20 (if I Can get the row adding to work fine, I can just do a count, and update the scroll bar every 10 or 20)<br><br>Also the String is being retreived from a URL, I'm using an Inet1 Control to grab it as it comes in, and loops until it's done comming in, but I am stuck at the point of doing if then checks for sections, and where to grab this, what to track and so forth. <p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
Karl,<br><br>Is your information coming in on a socket? <p>Steve<br><a href=mailto:tribesaddict@swbell.net>tribesaddict@swbell.net</a><br><a href= > </a><br>
 
no, its comming from an ASP that is made to return only the string<br><br><FONT FACE=monospace><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Inet1.AccessType = icDirect<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Inet1.Protocol = icHTTP<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Inet1.URL = Target<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Inet1.Execute<br></font><br><br>where Target = <A HREF=" TARGET="_new"> <p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
I'm going to attempt to reorganize my data into the following<br><br>Prop`ColumnInfomations`DataGroup1`DataGroup2`DataGroup3`InsertedTotals1`Inse<br>rtedTotals2`InsertedTotals3<br><br>ColumnInfo willl define the column setups and alignment for all Groups,<br>seperatly(as opposed to merging Column info into the firstgroup and use for<br>all)<br><br>ColName1^Width1^DataAlignment1^TotalAlignment1^DataFormat1^TotalFormat1^Show<br>Totals1¦<br>ColName2^Width2^DataAlignment2^TotalAlignment2^DataFormat2^TotalFormat2^Show<br>Totals2¦<br>ColName3^Width3^DataAlignment3^TotalAlignment3^DataFormat3^TotalFormat3^Show<br>Totals3<br><br>Also the Prop I'm just going to have it as 1 or 0 for AutoSize (may help the<br>looping ,since I only need to define it once)<br><br>DataGroups will simply be<br><br>Col1^Col2^Col3¦ (next row)<br>Col1^Col2^Col3¦<br>Col1^Col2^Col3¦<br>Col1^Col2^Col3<br><br>and Inserted Totals will be<br><br>ColPosition^ReplaceWith¦ColPosition^ReplaceWith¦ColPosition^ReplaceWith<br>(this can be blank, but Must use ` so we know next group is up)<br><br>I feel having the data aligned in this manner may help with my grabbing of<br>it as it comes, so that when I hit the second ` I can imediatly use the<br>completed AutoSize and Column Infomation, then I can worry about just the<br>Data Then Totals.<br><br>What do you think?, think it'll work better?<br> <p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
Steve,<br><br>Look at the Function Split in VB.&nbsp;&nbsp;You may need to do more than one (Split), however it is a great tool for seperating strings which are delimited by any consistient character.&nbsp;&nbsp;Since you have different delimiters, you will probably need to do the split on each Group, and then do additional an additional Split on the components.<br><br><br>Michael<br>
 
But keep in mind, I dont get all the data down at once I need to split as they come in. Also it's &quot;Karl&quot; <p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
Oh also this is what i have so far, you'll notices nothing is in between the Else and End If (I'll highlight it in red) but this should take care of my first two major group I redefinied two/three posts up, then I would just have to figure out how to grab the data strings, thereafter leaving the GrpIndex at the last completed data (also have to be watching for ` at the same time for the inserted totals which is going to see hard) <p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
<FONT FACE=monospace><br>Private Sub Inet1_StateChanged(ByVal State As Integer)<br>Select Case State<br>&nbsp;&nbsp;&nbsp;Case 12 Or 8 'Is Receiving a Response, or Response has been Received completely<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim TmpMinors<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim rtn As Long<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim InitComplete As Boolean<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim QuitLoop As Boolean<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InitComplete = False<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim Step As Integer<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Step = 1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim vtData As Variant ' Data variable.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim strData As String: strData = &quot;&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim bDone As Boolean: bDone = False<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Get first chunk.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vtData = Inet1.GetChunk(1024, icString)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoEvents<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Do While Not bDone<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strData = strData & vtData<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoEvents<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Get next chunk.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vtData = Inet1.GetChunk(1024, icString)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If Len(vtData) = 0 Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bDone = True<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If InitComplete = False Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rtn = InStr(1, strData, &quot;`&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If rtn &gt; 0 Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rtn = InStr(rtn + 1, strData, &quot;`&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rtn = InStr(GrpIndex, strData, &quot;¦&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;While rtn &gt; 0 And QuitLoop = False<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If InitComplete = False Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim InitStr As String<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim InitAry<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InitStr = Left(strData, rtn - 1)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InitAry = Split(InitStr, &quot;`&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If InitAry(0) = &quot;1&quot; Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LstI(0).AutoSize = True<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LstI(0).AutoSize = False<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LstI(0).ColumnList = InitAry(1)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QuitLoop = True<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GrpIndex = rtn + 1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InitComplete = False<br><font color=red>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If</font><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wend<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QuitLoop = False<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Loop<br>End Select<br>End Sub<br></font><br> <p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top