OZmium Sports Betting and Horse Racing Forums

OZmium Sports Betting and Horse Racing Forums (http://forums.ozmium.com.au/index.php)
-   General Topics (http://forums.ozmium.com.au/forumdisplay.php?f=59)
-   -   download unitab horse data into excel spreadsheet - problem (http://forums.ozmium.com.au/showthread.php?t=20306)

gsdanger 5th July 2010 09:22 PM

download unitab horse data into excel spreadsheet - problem
 
2 Attachment(s)
Hi All, and specifically Kennedy 22384

I have been following with interest your conversations with regards to using an excel spreadsheet for obtaining racing data from the unitab site. I have the same situation. I was given 2 spreadsheets from a member of this forum also – (I think his name was Peter – don’t know his alias). I have the same spreadsheet that has been outlined, however that spreadsheet actually pertains to gathering historical data for form analysis and trend following. The spreadsheet I have attached (Tomorrow racing today) actually allows you to input the day’s racing date and the venue code (example: MR for Melbourne Races etc). It downloads all the detailed form for the venue you have nominated.

I have been using this spreadsheet, in concert with a spreadsheet I have created (2nd attachment) to analyse each horses current form and rate, sort and price them according to the rating figures derived from this analysis. I can rate a race in 1 minute.

Unfortunately, about 12 months ago, I upgraded to Microsoft Office 7 suite, and at the same time upgraded my PC. My PCs operating system is now Windows 7.

I thought this transition to office 7 and windows 7 was the reason for my spreadsheets not functioning. Maybe not.

Could you possibly have a look, in the first instance the first attached spreadsheet (tomorrow racing today) and see if you can get it to download the detailed form from the unitab site. Currently, the spreadsheet works in a limited way. It downloads the abbreviated form available but not the detailed form.(the spreadsheet should also be populated to the right of column ‘Z’ also). Obviously the ‘Get external Date’ functions are working, however it seems that there is some sort of limiting factor (maybe with the unitab site) that is precluding the detailed form to be downloaded in it’s entirety.

Normally, when this spreadsheet obtains all the detailed form, I minimise it and open my other spreadsheet (KwikPick Form Analysis). All I have to do then is input all the day and race data on the main page (including the race date), then go to the race I want to rate (hyperlinked to the relevant worksheet). Here I only need to input the following in the ‘red’ area: YYYY/MM/DD/XRXX for example: 2010/07/MR05 and press the ‘Get Data’ Button. All the form is then downloaded into this spreadsheet and assessed. I then press the ‘sort and Price the Selections’ button. The horses are sorted in highest rated order and priced accordingly. Too easy!

This aspect has an error in it also (I think it’s a syntax error. I maybe wrong). Can you see if you can fix this also. The macro that pulls the data from the ‘tomorrow racing today’ spreadsheet into each race sheet is called ‘Get Data’, attached to the button with the same name.
I will be very thankful if you can assist me in getting these spreadsheets functioning correctly.

Kind Regards.

gsdanger

Crackone 6th July 2010 03:28 PM

It may be that Unitab changed its forms page you can't access it with out an account.

gsdanger 6th July 2010 06:52 PM

Hi Crackone,

thanks for your response. I have had an account with unitab for 5 years and it is still active! No money in it, as I only used it to access the detailed form guides.

Thanks for your response, however, I still need assistance, especially with the first spreadsheet (tomorrow racing today) as I will probably be able to fix the 2nd one myself (I created this one)....

Kind Regards,

gsdanger.

Crackone 7th July 2010 02:27 PM

For all my excel problems I go to mrexcel.com

gsdanger 7th July 2010 05:33 PM

Once again, thanks for your assistance Crackone.

I remember who supplied the first spreadsheet to me all those years ago. it was: OZDOC

OZDOC, if you read this thread please respond with some options.

Kennedy 22384, are you able to assist me with my problem? I really hope so, as I'm going down the punting gurgler without my ratings.

Kind Regards, and please assist, if you guys, or anyone else can.

gsdanger...

gsdanger 1st August 2010 06:51 PM

Calling OZDOC - Help!!!!
 
download unitab horse data into excel spreadsheet - problem

--------------------------------------------------------------------------------

Good Evening OZDOC,

I have been having data download problems with the spreadsheet (Tomorrow racing today - 1st attachemnt). I received this spreadshet from you 5 or 6 years ago and have been using this spreadsheet, in concert with a spreadsheet I have created (2nd attachment) to analyse each horses current form and rate, sort and price them according to the rating figures derived from this analysis. I can rate a race in 1 minute. Works well.

Unfortunately, about 12 months ago, I upgraded to Microsoft Office 7 suite, and at the same time upgraded my PC. My PCs operating system is now Windows 7.

I thought this transition to office 7 and windows 7 was the reason for my spreadsheets not functioning. Maybe not. Might be that the unitab site might have been upgraded, or re-configured.

Obviously, you will be familiar with the workings of the first spreadsheet (originally yours), so could you possibly have a look, the attached spreadsheet (tomorrow racing today) and see if you can get it to download the detailed form from the unitab site. Currently, the spreadsheet works in a limited way. It downloads the abbreviated form available but not the detailed form.(the spreadsheet should also be populated to the right of column ‘Z’ also). Obviously the ‘Get external Date’ functions are working, however it seems that there is some sort of limiting factor (maybe with the unitab site) that is precluding the detailed form to be downloaded in it’s entirety.

Normally, when this spreadsheet obtains all the detailed form, I minimise it and open my other spreadsheet (KwikPick Form Analysis). All I have to do then is input all the day and race data on the main page (including the race date), then go to the race I want to rate (hyperlinked to the relevant worksheet). Here I only need to input the following in the ‘red’ area: YYYY/MM/DD/XRXX for example: 2010/07/MR05 and press the ‘Get Data’ Button. All the form is then downloaded into this spreadsheet and assessed. I then press the ‘sort and Price the Selections’ button. The horses are sorted in highest rated order and priced accordingly.

I will be very greatful if you can assist me in getting this spreadsheet functioning correctly. Without it, I'm struggling to find an alternative web site to download appropriate data from, and am slowly dying on the punting vine. Please Help.....

Kind Regards.

gsdanger
Attached Files Tomorrow Racing Today.xls (1.05 MB, 41 views)

kennedy22384 10th November 2010 09:53 PM

i am so sorry i havent seen this message but lemme take a look at the files and see what can be done

kennedy22384 10th November 2010 10:14 PM

The issue here is two things,

one, if you are not a member of unitab, you only get the last 3 tab starts which is not accurate and two, unitab has redone the website which has made it kinda unfriendly for web data grab.

I will try to find an alternative website to go and use but im not sure if i can pull it off

Shaun 11th November 2010 01:28 AM

Try the ACT tab site site might be better.

kennedy22384 11th November 2010 01:30 PM

1 Attachment(s)
Ok, i think i fixed it up. I had to alter a few bits, for one the form doesnt come from unitab but the fields do.

All you need to do is open it up and go to macros and select RunAll and press run.

It will go through every horse race in australia on the day and spew out the sheets one by one.

Move all the result sheets (unitab codes) to another workbook after you are finished. Do not run it with all the sheets still in the workbook.

I built this on office for mac 2011. Im not sure if it works with windows so please test :)

Shaun 11th November 2010 03:11 PM

I see you are using the same form as i do for my ratings when i use them, i manually import each race as needed but have always wanted to automate the task so i might be able to steal some of your code if that's ok to get mine running.

kennedy22384 11th November 2010 03:11 PM

No prob just so long as you share it with everyone

kennedy22384 12th November 2010 08:45 AM

1 Attachment(s)
Updated, fixed a couple of issues and the date will change automatically for unitab. :)

the instructions still the same as above

Shaun 12th November 2010 09:00 AM

Mine crashed after running getrace3 said the internet web address does not exist

kennedy22384 12th November 2010 09:01 AM

you said runall right, you cannot just run the getraces3 macro, you have to run the runall macro

kennedy22384 12th November 2010 09:19 AM

1 Attachment(s)
Update, fixed some bugs that arose today. This will go on until they are all fixed

Shaun 12th November 2010 09:21 AM

That is correct, i will try it again i think it has something to do with the link.

kennedy22384 12th November 2010 09:25 AM

Another update on the way, just testing it and added code to delete the queries after each race. You may have noticed that the file size is increasing, that is due to the queries being held. i added code to take care of that. Will upload in about 20 mins or maybe less

Shaun 12th November 2010 09:33 AM

1 Attachment(s)
I uploaded the sheet as it is after i get the error, if you have a look on Racelists you will see under the date column it has replaced the date, i use win7 with office 2010

kennedy22384 12th November 2010 09:37 AM

It shouldnt have cause if you select a cell, it should say '2010-11-12
The single quotation mark makes sure it puts it in as the text and not the date

kennedy22384 12th November 2010 09:46 AM

1 Attachment(s)
Updated, still increasing file size, maybe to do with the fact it is xls. If you can save it as a xlsm file

kennedy22384 12th November 2010 09:51 AM

the issue with the racelist is to do with lines 100-101 in the code. Cause im on a mac, you may need to play with it and trial and error

Shaun 12th November 2010 10:31 AM

Code:
Sub GetRaces2() Sheets("RaceList").Select Sheets("RaceList").Range("A2:AB500").Select Selection.ClearContents Sheets("Races2").Select Sheets("Races2").Cells.Select Selection.ClearContents With Sheets("Races2").QueryTables.Add(Connection:= _ "URL;http://formguide.cyberhorse.com.au/index.php/Form/view-form.html" _ , Destination:=Sheets("Races2").Range("$A$1")) .Name = False .FieldNames = False .RowNumbers = False .FillAdjacentFormulas = False .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlOverwriteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .Refresh BackgroundQuery:=False End With A = 2 B = 2 strquote = Chr$(34) TrackName = vbNullString RaceNumber = 0 Do While Sheets("Races2").Cells(A, 1) <> vbNullString Or Sheets("Races2").Cells(A + 1, 1) <> vbNullString If IsNumeric(Sheets("Races2").Cells(A, 1)) = False Then TrackName = Sheets("Races2").Cells(A, 1) If TrackName = "Port Macquarie" Then TrackName = "Pt Macquarie" A = A + 2 End If If IsNumeric(Sheets("Races2").Cells(A, 1)) = True Then RaceNumber = Sheets("Races2").Cells(A, 1) Sheets("RaceList").Cells(B, 1) = TrackName Sheets("RaceList").Cells(B, 2) = RaceNumber Sheets("RaceList").Cells(B, 3) = "=GetAddress(Races2!E" & A & ")" Sheets("RaceList").Cells(B, 4) = "=SUBSTITUTE(C" & B & "," & strquote & "&" & strquote & "," & strquote & "&&" & strquote & ")" Sheets("RaceList").Cells(B, 4) = "http://" & "formguide.cyberhorse.com.au/index.php/Form/form.html?" & Right(Sheets("RaceList").Cells(B, 4), Len(Sheets("RaceList").Cells(B, 4)) - 80) Sheets("RaceList").Cells(B, 5) = "'" & Mid(Sheets("RaceList").Cells(B, 4), 70, 10) A = A + 1 B = B + 1 End If Loop RaceCount = B - 1 End Sub


My vba is limited but i can see where the problem is, in the above code if all we need is the address can't we just use what is outputted in column C

kennedy22384 12th November 2010 10:35 AM

No, for some reason the address that comes out is incorrect. i have to put in an extra 2 lines of code for column D. the first one adds an extra ampersand as excel removes the ampersand from any webpages. The second line of code sets up the correct webpage. the incorrect address does provide the information to convert it to the correct address.

Shaun 12th November 2010 12:44 PM

I will have a play with it when i get time, if i get it working i will create a ratings sheet that anyone can add there own figures to each form factor to make there own ratings.

Shaun 15th November 2010 10:06 PM

I am having an issue, i am using part of your code but it keeps dropping race 1 from each venue when it creates the racelist, bit of help needed.

Code:
'Global RaceCodes(1 To 20) As String 'Global RaceNumbers(1 To 12) As Integer Global RaceCount As Integer Global RaceNo As Integer Global RaceCode As String Sub RunAll() Application.Calculation = xlCalculationAutomatic GetRaces2 For RaceNo = 2 To 2 'RaceCount Next RaceNo End Sub Sub GetRaces2() Sheets("RaceList").Select Sheets("RaceList").Range("A2:AB500").Select Selection.ClearContents Sheets("Races2").Select Sheets("Races2").Cells.Select Selection.ClearContents With Sheets("Races2").QueryTables.Add(Connection:= _ "URL;http://formguide.cyberhorse.com.au/index.php/Form/view-form.html" _ , Destination:=Sheets("Races2").Range("$A$1")) .Name = False .FieldNames = False .RowNumbers = False .FillAdjacentFormulas = False .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlOverwriteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .Refresh BackgroundQuery:=False End With A = 2 B = 2 strquote = Chr$(34) TrackName = vbNullString RaceNumber = 0 Do While Sheets("Races2").Cells(A, 1) <> vbNullString Or Sheets("Races2").Cells(A + 1, 1) <> vbNullString If IsNumeric(Sheets("Races2").Cells(A, 1)) = False Then TrackName = Sheets("Races2").Cells(A, 1) If TrackName = "Port Macquarie" Then TrackName = "Pt Macquarie" A = A + 2 End If If IsNumeric(Sheets("Races2").Cells(A, 1)) = True Then RaceNumber = Sheets("Races2").Cells(A, 1) Sheets("RaceList").Cells(B, 1) = TrackName Sheets("RaceList").Cells(B, 2) = RaceNumber Sheets("RaceList").Cells(B, 3) = "=GetAddress(Races2!E" & A & ")" Sheets("RaceList").Cells(B, 4) = "=SUBSTITUTE(C" & B & "," & strquote & "&" & strquote & "," & strquote & "&&" & strquote & ")" Sheets("RaceList").Cells(B, 4) = "http://" & "formguide.cyberhorse.com.au/index.php/Form/form.html?" & Right(Sheets("RaceList").Cells(B, 4), Len(Sheets("RaceList").Cells(B, 4)) - 80) Sheets("RaceList").Cells(B, 5) = "'" & Mid(Sheets("RaceList").Cells(B, 4), 70, 10) A = A + 1 B = B + 1 End If Loop RaceCount = B - 1 End Sub Function GetAddress(HyperlinkCell As Range) GetAddress = Replace _ (HyperlinkCell.Hyperlinks(1).Address, "mailto:", "") End Function

Shaun 21st November 2010 01:56 PM

1 Attachment(s)
Using code provided by kennedy22384 i have put together a sheet that will download each race and output ratings, the value of each form figure can be changed on the "Tables" sheet just change the figures in red to suit your own ratings, if you wish to exclude a form criteria from your ratings just place an "X" in the box above that list to exclude.

You will need to remove all the days races that i have tested it on so delete all sheets after the "Data" sheet, there are still plenty of bugs and it crashes after a while and takes about 30 seconds a race to update so i still have work to do, or maybe others can solve the issues.

To start the sheet go to the "Data" sheet and hit "Start" If it does crash just hit Debug then close the VBA window and press "Re-Start" you may lose the info for that race but it should continue on.

I hope to have bugs fixed in a few days.

kennedy22384 21st November 2010 07:51 PM

Cool Shaun, I have just been data mining for greyhound's names for the last 5 days or so, i will test when im done with that cause then i got to get the form for each dog and let me say, this will take a while.

Shaun 21st November 2010 08:23 PM

I found a few bugs and am adding more ideas so that is just a rough draft

Shaun 21st November 2010 11:47 PM

1 Attachment(s)
Fixed a few bugs and added the option to import single race one at a time.
I also added a delete button that will delete all the extra sheets that are created when the days racing is done.

Open the sheet go to data and press Start this imports the race lists, then you have the option to use Automatic to import all races or Manual for a single race.

For single race option just click on the first cell of the race you want on the left hand side then press Manual

Shaun 22nd November 2010 03:39 AM

1 Attachment(s)
small update

Shaun 22nd November 2010 01:34 PM

1 Attachment(s)
Fixed Barrier number

Shaun 22nd November 2010 11:21 PM

1 Attachment(s)
Another update, fixed the crash between races and at the end, added a Hide/Umhide button on the data sheet that hides the formulas, all you need to do is come up with a good ratings method to add to this sheet and you will have a winner.

the imports are still very slow so if someone who knows VBA can have a look at that to see why.

Shaun 23rd November 2010 08:03 PM

I have updated the sheet but will store it offsite for easier updates the link is in my sig.

I have added some ratings figures and a new pricing system so will do some testing myself.

Thanks for the help in getting this done as it will make my own ratings much easier to use.

moeee 24th November 2010 07:19 AM

Hey Kennedy91210

Is GRRR still about?
I ain't seen it around for ages.

Shaun 24th November 2010 05:07 PM

New file uploaded, i think i have solved the issue with venue names so it should see all venues.

If the race has resulted it will display results, when you first run the sheet it will ask for a date, press ok for todays races or change the date to back test your ratings.

On the main page you can adjust the race times by putting in your time difference from eastern states times, example 3 for correct Perth times 1 for Brisbane times and so on.

Still trying to sort out the speed and had an issue with it freezing today so will look at that.

Shaun 24th November 2010 05:37 PM

Since i have made a few changes on the next update i will add instructions, will also add ability to delete races from RaceLists for those venues you are not interested in rating.

moeee 24th November 2010 05:39 PM

Is there any Chance of giving away your Program in an older version of Excel?
My 2003 won't recognise it.
Or is there something in the program what Older Excel cannot possibly do?

Shaun 24th November 2010 07:23 PM

Give this version a try, should work ok, i will add an extra link in my info later for this version and try to remember to update it.

http://www.box.net/shared/zb6lsevs2v

moeee 24th November 2010 07:32 PM

Thank You.

I'm not a horse person, but the way My Greyhounds is going, or not going, I'm thinking a change be best before a Lack of BANK decides the change will be no punting at all.


All times are GMT +10. The time now is 09:24 PM.

Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.