1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
Function Add0(nb)
If CInt(nb) < 10 Then
nb = "0" & CStr(nb)
End If
Add0 = nb
End Function
' This function trims the string to the next ";" Ex: "1;2;3" becomes "2;3"
' Variable iCell is used to keep track of the current cell
Function NextCsvCell(ByRef iCell,TxtLine)
iCell = iCell + 1
iPos = InStr(TxtLine,";")
TxtLine = Right(TxtLine,Len(TxtLine) - iPos)
NextCsvCell = TxtLine
End Function
' This function returns the content of the string up to the first ";"
' Ex: "1;2;3" returns "1"
' Returns an empty string if no ";" are found
Function CurrCsvCell(TxtLine)
iPos = InStr(TxtLine,";")
If iPos = 0 Then
CurrCsvCell = ""
Else
CurrCsvCell = Left(TxtLine,iPos - 1)
End If
End Function
Function Process(vPerfDate)
dim objXML, objLst, objHdl, noOfFund, fs, isFound, isFundFound, fCsvPerf, isError, i, j
dim FundNumberFront, FundNumberBack, FundNameEn, FundNameFr, FundPerfCode
Dim c3mo, c6mo, c1yr, c3yr, c5yr, c10yr, cYTD, cIncept, cFormatted, cCurrPct
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
Set objLst = Server.CreateObject("Microsoft.XMLDOM")
Set objHdl = Server.CreateObject("Microsoft.XMLDOM")
objXML.async = False
objXML.Load (Server.MapPath("data/MyFundList.xml"))
If objXML.parseError.errorCode <> 0 Then
Response.Write(objXML.parseError.reason)
Response.End
End If
Set objLst = objXML.getElementsByTagName("Fund")
noOfFund = objLst.length
dim csvPerf
dim tDate
isError = true
Set fs=Server.CreateObject("Scripting.FileSystemObject")
csvPerf = "data/" & "perf." & year(vPerfDate) & Add0(month(vPerfDate)) & Add0(day(vPerfDate))
csvPerf = server.mappath(csvPerf)
If (fs.FileExists(csvPerf))= True Then
isFound = true
isError = false
End If
if isError = true then
Response.Write ("<b>An error has occured, no file was found <br><br>")
Response.Write ("Performance data file found " & " = " & fs.FileExists(csvPerf) & "<br><br>")
Response.Write ("Please upload missing files</b>")
Response.End
end if |
Partager