Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

DBEngine.clsLeague.GetTeamsInLeague

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Current Games From Matrix.] >> [Sports] >> Maximum-Football 2.0 >> 3rd Party Developers Area >> DBEngine.clsLeague.GetTeamsInLeague Page: [1]
Login
Message << Older Topic   Newer Topic >>
DBEngine.clsLeague.GetTeamsInLeague - 3/25/2007 9:49:09 PM   
PackerMan32

 

Posts: 15
Joined: 5/6/2006
Status: offline
I am back to working on Utilities for Maximum football and have come to a problem. I am using the provided DBEngine DLL to retrieve some to the team data, but I cannot seem to get a team object out of the provided interfaces. I have my clsLeagueData object and I want to retrieve every team, conference, and division in that league and I thought that the GetTeamsInLeague function would do this for me. However, everytime I use this function it returns a null collection. Is this function not implemented yet? Also, what are valid vOrderBy parameters to pass to this function. Hopefully David or any other developer familiar with the MF API can help me out here. I am programming in C#. Thanks!
Post #: 1
RE: DBEngine.clsLeague.GetTeamsInLeague - 3/25/2007 10:48:21 PM   
PackerMan32

 

Posts: 15
Joined: 5/6/2006
Status: offline
Okay, I now have got a collection of team id's fromt he GetTeamsInLeague function. But this is not what I need. I'm not quite sure how to extract a team data object or load a team data object using the DBEngine api. Any advice?

(in reply to PackerMan32)
Post #: 2
RE: DBEngine.clsLeague.GetTeamsInLeague - 3/26/2007 1:00:51 AM   
David Winter

 

Posts: 5158
Joined: 11/24/2004
From: Vancouver, BC
Status: offline
vOrderBy is the name of the field in the Teams database table you wish to order the records by. It gets used in the Select statement of the query. 

Starting from the point you have the teamID...

Dim CTeam as DBEngine.clsTeamData

Set CTeam = new DBEngine.clsTeamData
call CTeam.GetRecord("ID=" & mTeamIDObtainedPreviously)

With CTeam
'//Do things with the team
End With

set CTeam = Nothing '//Clean up when done.


Sometimes the DBEngine will return a team data class (or player data class). Use the Object Browser(F2) to to find out what a particular API will return.

There are no functions in the DBEngine that are not implemented. All functions do something, so if it's not doing anything, it's likely that you're not using the function correctly.

One thing to keep in mind if you're programming in C# is that DBEngine returns a type VBA.CollectionClass and those are not compatible with Collections in C# (I don't even think C# has a sense of collections in the VB sense). So you may need to do some sort of cast (or do a manual loop through conversion) to get them to the object type you need.

Also be aware that your application will need to be compiled to specific builds of DBEngine.dll. As I make fixes or add new features at users requests, the DBEngine will break binary compatibility.

(in reply to PackerMan32)
Post #: 3
RE: DBEngine.clsLeague.GetTeamsInLeague - 3/26/2007 1:05:48 AM   
David Winter

 

Posts: 5158
Joined: 11/24/2004
From: Vancouver, BC
Status: offline
Ohh wait.. GetTeamsInLeague returns a collection of clsTeamData Classes already so all you need to do is this;

Dim CTeam as DBEngine.clsTeamData
Dim colTeams as Collection

(open the league database)

set colTeams = mLeagueData.GetTeamsInLeague("City")

if colTeams.Count > 1 then
Set CTeam = colTeams(1) '//As an example, set the team to the first one returned in the collection

'//Now do something with the team.

End if

'//Clean up when done
set colTeams = nothing
set CTeam = nothing


If you want specific teams in a division, you need to use the GetTeamsInDivision function (and pass in the divisionID)



< Message edited by David Winter -- 3/26/2007 1:06:28 AM >

(in reply to David Winter)
Post #: 4
RE: DBEngine.clsLeague.GetTeamsInLeague - 3/26/2007 3:32:17 AM   
PackerMan32

 

Posts: 15
Joined: 5/6/2006
Status: offline
Ok that's what I was trying to do. C# does have a VBA.Collection object so I can use that. I did get it to work, however it will only work when I pass an empty string as the vOrderBy parameter. If I pass anything else it will return a null collection. I'll do some more research and see if I can't figure out why it is failing.

I think that was my problem previously, I had always passed a field name as the vOrderBy parameter because I figured that's how it would sort the collection. I did notice however that it requests that the parameter is sent by Reference, which means in C# instead just calling the function like GetTeamsInLeague("City") I need to call it as such GetTeamsInLeague(ref vOrderBy), where vOrderBy is the string containing the order field. I'm wondering if the by reference requirement isn't messing it up because the string data types aren't the same between VB6 and C#.

(in reply to David Winter)
Post #: 5
RE: DBEngine.clsLeague.GetTeamsInLeague - 3/26/2007 6:19:34 AM   
David Winter

 

Posts: 5158
Joined: 11/24/2004
From: Vancouver, BC
Status: offline
Hmmm you're right, it is passing it in as reference.. that's my mistake.. it should have been by value. Well, minor issue that shouldn't cause any problems as long as you're aware of it.

That said, I've gone through my core game code and have noticed I'm no longer passing in any paramaters to that function so the vOrderBy is probably dead code and you should just use a null string for that...

(in reply to PackerMan32)
Post #: 6
RE: DBEngine.clsLeague.GetTeamsInLeague - 3/26/2007 8:49:15 AM   
Tbird


Posts: 1187
Joined: 12/15/2004
Status: offline
Oooh can't wait to see what's cookin 

_____________________________


(in reply to David Winter)
Post #: 7
RE: DBEngine.clsLeague.GetTeamsInLeague - 3/27/2007 12:48:13 AM   
PackerMan32

 

Posts: 15
Joined: 5/6/2006
Status: offline
Thanks for the clarification David.

(in reply to Tbird)
Post #: 8
Page:   [1]
All Forums >> [Current Games From Matrix.] >> [Sports] >> Maximum-Football 2.0 >> 3rd Party Developers Area >> DBEngine.clsLeague.GetTeamsInLeague Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

6.592