?
Solved

innertext html reading

Posted on 2012-08-25
4
Medium Priority
?
342 Views
Last Modified: 2012-08-26
Community,

 I have been able to identify a table, and pull all of the text from the table. So far I have it write the data from the table to a text file, however you get a list like my list below. I would like to read the order number and if status is complete to only pull that block. I would need help with the code on this one, thank you all very much. The data in the table changes, and is never static.

Order #:187
Forced:N
Client: 0013578
SKU Information:
SKU #1000011 - FULL SCREEN SETUP
SKU #1100001 - CUSTOM WIRE WRAP
SKU #1200001 - STUDIO PADDING
SKU #1110002 - DESKTOP CHAIR
SKU #2840001 - TOWER POWER
SKU #6278011 - DELIVERY
Order Status:Complete
Order #:1877
Forced:N
Client: 0013578
SKU Information:
SKU #1000011 - FULL SCREEN SETUP
SKU #1100001 - CUSTOM WIRE WRAP
SKU #1200001 - STUDIO PADDING
SKU #1110002 - DESKTOP CHAIR
SKU #2840001 - TOWER POWER
SKU #6278011 - DELIVERY
Order Status:Open
Order #:978642
Forced:N
Client: 0013578
SKU Information:
SKU #1000011 - FULL SCREEN SETUP
SKU #1100001 - CUSTOM WIRE WRAP
SKU #1200001 - STUDIO PADDING
SKU #1110002 - DESKTOP CHAIR
SKU #2840001 - TOWER POWER
SKU #6278011 - DELIVERY
Order Status:Open
0
Comment
Question by:-Geek
  • 2
  • 2
4 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 38334234
...so based on your last couple of questions, are you wanting to get all the SKUs associated with each completed order?
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 38334274
Try something like this out:
Public Class Form1

    'Example record:

    'Order #:187
    'Forced:N
    'Client: 0013578
    'SKU Information:
    'SKU #1000011 - FULL SCREEN SETUP
    'SKU #1100001 - CUSTOM WIRE WRAP
    'SKU #1200001 - STUDIO PADDING
    'SKU #1110002 - DESKTOP CHAIR
    'SKU #2840001 - TOWER POWER
    'SKU #6278011 - DELIVERY
    'Order Status:Complete

    Public Class Order
        Public OrderNumber As String
        Public SKUs As New List(Of String)
    End Class

    Private CompletedOrders As New List(Of Order)

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim line As String
        Dim OrderTag As String = "Order #:"
        Dim StatusCompleteTag As String = "Order Status:Complete"
        Dim SkuTag As String = "SKU #"
        Dim CurrentOrder As Order = Nothing

        ' Parse the file:
        CompletedOrders.Clear()
        Dim FileName As String = "C:\Users\Mike\Documents\SomeFile.txt" ' "c:\some folder\path\file.txt"
        Dim SR As New System.IO.StreamReader(FileName)
        While Not SR.EndOfStream
            line = SR.ReadLine
            If line.StartsWith(OrderTag) Then
                CurrentOrder = New Order
                CurrentOrder.OrderNumber = line.Remove(0, OrderTag.Length).Trim
            ElseIf line.StartsWith(SkuTag) Then
                If Not IsNothing(CurrentOrder) Then
                    CurrentOrder.SKUs.Add(line.Remove(0, SkuTag.Length).Split(" ")(0).Trim)
                End If
            ElseIf line.StartsWith(StatusCompleteTag) Then
                If Not IsNothing(CurrentOrder) Then
                    CompletedOrders.Add(CurrentOrder)
                End If
                CurrentOrder = Nothing
            End If
        End While
        SR.Dispose()

        ' Display the results:
        For Each CompleteOrder As Order In CompletedOrders
            Debug.Print("Order #" & CompleteOrder.OrderNumber)
            For Each SKU As String In CompleteOrder.SKUs
                Debug.Print("SKU #" & SKU)
            Next
        Next
    End Sub

End Class

Open in new window

0
 
LVL 1

Author Comment

by:-Geek
ID: 38334467
Changed the debug.print to a msgbox, and nothing pops up in the msgbox. I'm working on trying to get the result currently still.
0
 
LVL 1

Author Closing Comment

by:-Geek
ID: 38334471
Had to tweek a string to OrderStatus:Closed ;) worked like a charm.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Integration Management Part 2
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question