Help on XML feed
Can anyone help me with getting the live feed from Tatts into an excel spreadsheet. I've tried Tatts help page but keep getting an error. I've tried many times over the past 12 months but always the same story. I have Excel 2010.
Thanks |
Most of my work has been designed around web queries but if you are after updating prices XML would be better, i have done some work in the past with this, have you copied the sample in to excel and just played with the code to get the information needed.?
|
1 Attachment(s)
Just get this error massage Shaun. I put todays date in the script to copy.
|
1 Attachment(s)
Hang on Shaun, I had VR4 not MR4, so I fixed that but now all I get is Saddelcloth no. Horse name, wght & Jockey....no prices. Must be getting warmer, hey?
|
I don't have a working version of this so just going by looking at the example but I'm assuming its because your using the example which only pulls in those 4 areas by using:
Set runnerNumber = runner.Attributes.getNamedItem("RunnerNo") Set runnerName = runner.Attributes.getNamedItem("RunnerName") Set runnerWeight = runner.Attributes.getNamedItem("Weight") Set riderName = runner.Attributes.getNamedItem("Rider") So Shaun can correct me but i'm guessing you'd have to add something like: Set runnerOdds = winodds.Attributes.getNamedItem("Lastodds") and then to have this show in excel add something this as well: If Not runnerOdds Is Nothing Then Sheet1.Cells(i + 1, 5) = runnerOdds.Text End If EDIT: By the way I don't use this at all but thought i'd check it out as i'm into website coding and this whole datafeeds stuff. Give the above a try, Shaun might be able to correct it though if i've missed something? 2nd EDIT: Actually in the attributes part "Lastodds" will bring in the last fluc i think, might have to have this as just "Odds" |
1 Attachment(s)
Some error here Josh, debug report below. Greedy as I am...l:), assuming we can overcome this bug, how could you get all races displayed?
|
You are correct, you need to add in the extra code and make changes.
This page https://tatts.com/tattsbet_help/info/xml-feed lists all the XML feed pages and if you open a feed you will be able to see what's needed, am kinda busy right now but after todays races i can knock up a sheet that will list the extra items, been awhile since i looked at this myself |
RCP I think it has something to do with the following section needing to be set up for the Winodds part:
Set runnerList = xmldoc.selectNodes("//Runner") Sheet1.Cells.Clear For i = 0 To (runnerList.Length - 1) Set runner = runnerList.Item(i) I'd have to fiddle with the code later on as about to go to work. But i'd suggest its this section that also needs to be fiddled with to account for the Winodds addition. |
Cheers to both Josh and Shaun, It'll have to wait till after the races now as very busy too, good day so far, hope yours is to?
|
RCP after a bit of stuffing around to get it to initially work give this a try:
Sub LoadRaceField() Dim xmldoc As MSXML2.DOMDocument Set xmldoc = New MSXML2.DOMDocument xmldoc.async = False xmldoc.Load ("http://tatts.com/pagedata/racing/2014/5/21/SR7.xml") If (xmldoc.parseError.errorCode <> 0) Then MsgBox ("An error has occurred: " & xmldoc.parseError.reason) Else Set runnerList = xmldoc.selectNodes("//Runner") Set oddsList = xmldoc.selectNodes("//WinOdds") Sheet1.Cells.Clear For i = 0 To (runnerList.Length - 1) Set Runner = runnerList.Item(i) Set winodds = oddsList.Item(i) Set runnerNumber = Runner.Attributes.getNamedItem("RunnerNo") Set runnerName = Runner.Attributes.getNamedItem("RunnerName") Set runnerWeight = Runner.Attributes.getNamedItem("Weight") Set riderName = Runner.Attributes.getNamedItem("Rider") Set runnerOdds = winodds.Attributes.getNamedItem("Odds") If Not runnerNumber Is Nothing Then Sheet1.Cells(i + 1, 1) = runnerNumber.Text End If If Not runnerName Is Nothing Then Sheet1.Cells(i + 1, 2) = runnerName.Text End If If Not runnerWeight Is Nothing Then Sheet1.Cells(i + 1, 3) = runnerWeight.Text End If If Not riderName Is Nothing Then Sheet1.Cells(i + 1, 4) = riderName.Text End If If Not runnerOdds Is Nothing Then Sheet1.Cells(i + 1, 5) = runnerOdds.Text End If Next End If End Sub |
All times are GMT +10. The time now is 10:55 PM. |
Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.