La communauté ALL HTML c'est 58235 membres à ce jour dont 0 inscrits aujourd'hui et 32 depuis une semaine.
Retrouvez les publications relatives à ces discussions dans nos rubriques asp, sql.
liste des forums liste des discussions Participer à la discussion
Message publié le mercredi 01 novembre 2006 à 20 h 10 par sperron. Suzanne Perron
PC Santé
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
Set RegularExpressionObject = New RegExp
For i = 0 To (noOfFund - 1)
Set objHdl = objLst.item(i)
FundNumberFront = objHdl.childNodes(0).text
FundNumberBack = objHdl.childNodes(1).text
FundNameEn = objHdl.childNodes(2).text
FundNameFr = objHdl.childNodes(3).text
FundPerfCode = objHdl.childNodes(4).text
set fCsvPerf = fs.opentextfile(csvPerf)
dim cLine, iPos, iCell
cLine = ""
isFundFound = False
while not fCsvPerf.AtEndOfStream
cLine = fCsvPerf.readLine
iPos = 0
iCell = 1
While iCell < 25
cLine = NextCsvCell(iCell, cLine)
Wend
If trim(CurrCsvCell(cLine)) = FundPerfCode Then
isFundFound = True
'C'EST ICI QUE J'AI LE PROBLÈME, COMMENT FAIRE POUR REVENIR AU DÉBUT DE CETTE LIGNE APRÈS VALIDATION ?
cLine = NextCsvCell(iCell, cLine)
While iCell < 25
Select Case iCell
Case 10 c3mo = CurrCsvCell(cLine)
Case 11 c6mo = CurrCsvCell(cLine)
Case 13 c1yr = CurrCsvCell(cLine)
Case 15 c3yr = CurrCsvCell(cLine)
Case 17 c5yr = CurrCsvCell(cLine)
Case 22 c10yr = CurrCsvCell(cLine)
Case 23 cYTD = CurrCsvCell(cLine)
Case 24 cIncept = CurrCsvCell(cLine)
End Select
Wend
End If
wend
if (Not isFundFound) then
Response.Write("Error when trying to find performance for fund #" & FundNumberFront & "-" & FundNameEn & "<br>")
Response.Write("Fund not found in the New Fund file<br>")
Response.Write("Verify the prices files, and upload them again")
Response.End
end if
Message publié le mercredi 15 novembre 2006 à 16 h 35 par Vyse.
Vyse, pirate de l'air du Web cLine = fCsvPerf.readLine
iPos = 0
iCell = 1
LineToValidate = cLine
While iCell < 25
LineToValidate = NextCsvCell(iCell, LineToValidate)
Wend
If trim(CurrCsvCell(LineToValidate)) = FundPerfCode Then
isFundFound = True
...
'pour revenir au début de la ligne
iPos = 0
iCell = 1
'et utilise ensuite la variable cLine qui contient toujours la ligne complète
liste des forums liste des discussions Participer à la discussion
Vous devez obligatoirement vous identifier en tant que membre pour participer à cette discussion.