Logical Error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eric

    Logical Error

    My program works fine accept that when the pattern contains information
    more than one line it shows only the first line. For example if you
    look into Summary the information is in more than 1 line but it shows
    only the first line needs help

    i=0
    j=0
    dim alldata(99999,3 0)
    Function EnumerateFolder ( sFolder )

    Dim fso, ts, data
    Set fso = CreateObject("S cripting.FileSy stemObject")
    Set fol = fso.Getfolder ( server.mappath( sfolder) )
    For each fil in fol.files
    Set ts = fil.openastexts tream(1)
    Do While Not ts.AtEndOfStrea m
    data = ts.ReadLine
    If test(Left(data, 4)) Then
    data = ts.ReadLine
    alldata(i,j)=da ta
    End If
    Loop
    Next
    ts.Close
    End Function

    EnumerateFolder "c:\txt"
    for k=1 to 20
    response.write( alldata(0,k))
    response.write( "<br>")
    next

    Function test(s)
    Select Case s

    Case "[Dat"
    test = True

    Case "[Nov"
    j=j+1
    test = True

    Case "[Sub"
    j=j+1
    test = True

    Case "[Cus"
    j=j+1
    test = True

    Case "[Str"
    j=j+1
    test = True

    Case "[Cit"
    j=j+1
    test = True

    Case "[Acc"
    j=j+1
    test = True

    Case "[Ins"
    j=j+1
    test = True

    Case "[Las"
    j=j+1
    test = True

    Case "[PPV"
    j=j+1
    test = True

    Case "[Mon"
    j=j+1
    test = True

    Case "[Cur"
    j=j+1
    test = True

    Case "[Typ"
    j=j+1
    test = True

    Case "[Lan"
    j=j+1
    test = True

    Case "[CRC"
    j=j+1
    test = True

    Case "[Eve"
    j=j+1
    test = True

    Case "[Sum"
    j=j+1
    test = True

    Case "[Box"
    j=j+1
    test = True

    Case "[MD"
    j=j+1
    test = True

    Case "[Con"
    j=j+1
    test = True

    End Select
    End Function





    PROCESS DATA
    ------------
    NSMITH4
    PPV / VOD Research - Dispute - 1st Time - 711579
    EDWARD CAMPBELL
    5 WHEELER AVE APT 2
    BRIDGEPORT CT, 06606
    006-0416-08
    06/21/2001
    06/29/2006
    No
    186.52
    Optimum Voice
    Dispute - 1st Time
    English
    Yes
    #77922 6/29, #78306 6/29, #77716 6/28, #77312 6/28
    cust states that they and no one in the household ever
    2,SABKDTHBF,Yes ,Yes,Yes,Yes
    651789


    ACTUAL DATA
    -----------
    [Date]
    Sat Aug 05 14:06:12 EDT 2006

    [Novell ID]
    NSMITH4

    [Subject]
    PPV / VOD Research - Dispute - 1st Time - 711579

    [Customer's Name]
    EDWARD CAMPBELL

    [Street]
    5 WHEELER AVE APT 2

    [City, State, Zip]
    BRIDGEPORT CT, 06606

    [Account Number]
    006-0416-08

    [Install Date]
    06/21/2001

    [Last Known Event Date]
    06/29/2006

    [PPV Hold]
    No

    [Monthly Rate]
    186.52

    [Current Services]
    Optimum Voice
    OOL FamilyorAbv
    OR$20Discount
    iO Silver Pkg
    iO Box
    PPOF
    Addset: C/Rdy
    OV World Call
    OV Ported Number

    [Type of Request]
    Dispute - 1st Time

    [Language]
    English

    [CRC PIN Instructions]
    Yes

    [Event Numbers/Date Range]
    #77922 6/29, #78306 6/29, #77716 6/28, #77312 6/28

    [Summary]
    cust states that they and no one in the household ever
    ordered those ppv movies.cust requesting credit of
    $35.80.

    [Box Verification by Customer]
    2,SABKDTHBF,Yes ,Yes,Yes,Yes

    [MD Page ID]
    1

    [Control Number]
    651789

  • Bobbo

    #2
    Re: Logical Error

    Eric wrote:
    Do While Not ts.AtEndOfStrea m
    If test(Left(data, 4)) Then
    data = ts.ReadLine
    alldata(i,j)=da ta
    End If
    Loop
    [Summary]
    cust states that they and no one in the household ever
    ordered those ppv movies.cust requesting credit of
    $35.80.
    >
    [Box Verification by Customer]
    2,SABKDTHBF,Yes ,Yes,Yes,Yes

    Considering the input and code above, it looks like [without actually
    running a test] the problem is caused by the following sequence of
    events:
    1. test() function encounters [Summary] line and returns true
    2. The ReadLine method populates the data variable with the next line
    "cust states.."
    3. The alldata(i,j) array element is populated with the data variable
    4. Your data variable now doesn't satisfy the cases in the test()
    function so the remaining lines are skipped, until it reaches [Box
    Verification...]

    Try inserting some debugging lines to help you see what's going on,
    e.g. response.write( data) just after you've read it from the stream.

    Comment

    Working...