helpeachother
Programmer
Hello, everyone:
I am a new member of this group and need your help to dibug my code. I wrote a function named "getMemoryData" and it gives me an error message saying that the arguments are not specified,but I did. Will you help me to see the error(s) that I cannot see? Thanks.
The part of the code I am calling the function:
----------
'build url of memory usage frame page
url = txtePerf.Text + CType(hCustomers.Item(customer), String) + _
mtx + "_MTX/mtx_memory/tables/mtx_memory.1.php"
'grab the data off the web server
block = getWebPage(url)
Dim searchDate As String
searchDate = Format(linkDate, "yyyyMMdd")
memoryData = getMemoryData()
======================================
Here is the function:
Function getMemoryData(ByVal block As String, ByVal searchDate As String) As String()
Dim matches, num As System.Text.RegularExpressions.MatchCollection
Dim regExp As Regex
Dim temp, mData(3) As String
Dim tempDate As Date
Dim cnt As Integer
cnt = 0
mData(0) = "" : mData(1) = "" : mData(2) = "" : mData(3) = ""
For Each m As Match In matches 'process matches
temp = m.Value
If searchDate.ToString = Microsoft.VisualBasic.Left(temp, 8) Then
regExp = New Regex("<td[^>]*>(\d\d\d\d)(\d\d)(\d\d) \d\d:\d\d:\d\d</td>" + _
"\s*<td[^>]+?>(\d+)</td>\s*<td[^>]+?>(\d+)</td>\s*<td[^>]+?>(\d+)</td>" + _
"\s*<td[^>]+?>(\d+)</td>\s*<td[^>]+?>(\d+)</td>\s*<td[^>]+?>(\d+)</td>" + _
"\s*<td[^>]+?>(\d+)</td>\s*<td[^>]+?>(\d+)</td>\s*<td[^>]+?>(\d+)</td>")
matches = regExp.Matches(block)
End If
Next
'Only do this if there was a result from MTX Memory page
If matches.Count > 0 Then
Dim memoryData(3) As String
'process data if the date matches.
For Each m As Match In matches
memoryData(0) = m.Groups(4).ToString 'DS Used (KB)
memoryData(1) = m.Groups(7).ToString 'PS Used (KB)
memoryData(2) = m.Groups(12).ToString 'Provisioned Memory (KB)
memoryData(3) = m.Groups(11).ToString 'Physical Spare (KB)
cnt += 1
mData = memoryData
Next
End If
Return (mData)
End Function
=================================================
Thanks for your help!
KHWright
I am a new member of this group and need your help to dibug my code. I wrote a function named "getMemoryData" and it gives me an error message saying that the arguments are not specified,but I did. Will you help me to see the error(s) that I cannot see? Thanks.
The part of the code I am calling the function:
----------
'build url of memory usage frame page
url = txtePerf.Text + CType(hCustomers.Item(customer), String) + _
mtx + "_MTX/mtx_memory/tables/mtx_memory.1.php"
'grab the data off the web server
block = getWebPage(url)
Dim searchDate As String
searchDate = Format(linkDate, "yyyyMMdd")
memoryData = getMemoryData()
======================================
Here is the function:
Function getMemoryData(ByVal block As String, ByVal searchDate As String) As String()
Dim matches, num As System.Text.RegularExpressions.MatchCollection
Dim regExp As Regex
Dim temp, mData(3) As String
Dim tempDate As Date
Dim cnt As Integer
cnt = 0
mData(0) = "" : mData(1) = "" : mData(2) = "" : mData(3) = ""
For Each m As Match In matches 'process matches
temp = m.Value
If searchDate.ToString = Microsoft.VisualBasic.Left(temp, 8) Then
regExp = New Regex("<td[^>]*>(\d\d\d\d)(\d\d)(\d\d) \d\d:\d\d:\d\d</td>" + _
"\s*<td[^>]+?>(\d+)</td>\s*<td[^>]+?>(\d+)</td>\s*<td[^>]+?>(\d+)</td>" + _
"\s*<td[^>]+?>(\d+)</td>\s*<td[^>]+?>(\d+)</td>\s*<td[^>]+?>(\d+)</td>" + _
"\s*<td[^>]+?>(\d+)</td>\s*<td[^>]+?>(\d+)</td>\s*<td[^>]+?>(\d+)</td>")
matches = regExp.Matches(block)
End If
Next
'Only do this if there was a result from MTX Memory page
If matches.Count > 0 Then
Dim memoryData(3) As String
'process data if the date matches.
For Each m As Match In matches
memoryData(0) = m.Groups(4).ToString 'DS Used (KB)
memoryData(1) = m.Groups(7).ToString 'PS Used (KB)
memoryData(2) = m.Groups(12).ToString 'Provisioned Memory (KB)
memoryData(3) = m.Groups(11).ToString 'Physical Spare (KB)
cnt += 1
mData = memoryData
Next
End If
Return (mData)
End Function
=================================================
Thanks for your help!
KHWright