Up to now, no reply so thought I'd give it a second try.Further explanation to my previous request.I use a Value list of DivisionsDiv oneDiv twoDiv threeetcUsing this VL I select a Division. Selecting a Division pours the teams in that Division into a Portal called Divisions/teams--Below left.PORTAL Teams in Division PORTAL List of gamesTeam one [ GameTeam two [ GameTeam three [ GameTeam four [ GameTeam five [ GameTeam six [ GameThe portal Above on the right is related to the Schedules table which contains all games to be played in all divisions.I want to use the teams in the Portal Teams in Division as buttons to deliver the selected teams schedule into the portal on the right. I have tried various approaches and am still stumped. I'd be grateful for clear help on how to script this for a button attached to team names.(FYI--Currently, I have a VL approach in a field called Teams. By selecting a team from the VL, this delivers that teams list of games into the Portal List of games so I am pretty sure my match field is OK.)Thanks for reading!
From your posts I understand that you are trying to create a game-planning. To do that i think you'll need to slightly alter your approach:
I would expect a league to contain Divisions. (table: Division)
A Division contains teams. (table: Team)
A league would have a weekly game schedule. (table: Schedule)
A schedule contains games. (table: Game)
The fields in Division:
The fields in Team
The fields in Schedule
FK_Season (not in ERD)
The Fields in Game
The 3 first table contain the info that you want to show in the 4th table,
so the relations could look like this:
FK_Division from Team connects to PK_Division
FK_Division from Schedule connects to PK_Division (from schedule)
FK_Schedule from Game connects to PK_Schedule (from game)
FK_Team_Home from Game connects to PK_Team
FK_Team_Home from Game connects to PK_Team
The valuelist for team that you create should be created from the TableOccurrence "Team" but that will only work after you have entered the FK_Division in the current game-record. (of coarse you'd already have populated the Team-table with teams and enter a FK_Division for each team)
Hope this helps.
Menno, thanks for your reply. I apppreciate the thought you put into it.
In fact, my set up is very similar to the one you outlined. I already have Tables for Division, Teams and Games. And another table which pulls everything together much like your description. All of my relationships seem to be OK.
Keep in mind, I do already have a functioning Value List approach that populates the PORTAL:SCHEDULE OF GAMES with a selected teams games. This works thru the following sequence. VL in field Division to select a Division. Then another VL in field Team_names to choose a team. The field team_name is related to a calculated field Game in the TABLE:SCHEDULE (Which contains individual records for each game. Approx 1500 games across all Divisions.)
However, what I want to do is use the team_name field in the PORTAL:TEAMS IN DIVISION as a button that triggers a script to populate the PORTAL:SCHEDULE OF GAMES with that teams games for the season. I am floundering over how to create this. Any ideas on this would be greatly welcomed!
(And FYI, i am not trying to create a schedule. The schedule already exists. I import it into my DB for admin purposes.)
You can create a script and attach it to a button that populates values in a related table. As an example, your script step might look like:
Set Variable [ $team ; <team name> ]
Go to Related Record [ <from current table> ; <layout of related table> ]
Set Field [ <team name> ; $team ]
This should get you pointed in the right direction.
TS, thanks for your advice. Unfortunately I think I've lost the plot somewhere! Below is the script I attached to the Portal that contains the teams in Division.Set Variable [ $team_name ;Value:GAMES::Gl_Team_name]Go to Related Record [Show only related records;Match found set; From Table:"SCHEDULE", Using layout <Current Layout> ]New Record/Request/PageSet Field [ SCHEDULE:: Sched_for_suspension]***(*** This is the field that contains a calculation displaying one game of the selected team and looks like this: Game number; On 10/06/2009 :Team One vs Selected Team.The PORTAL for the Schedule contains 20 rows for 20 games with this field.)I have tried various iterations of the script and get the following message when I activate the script."This operation could not be completed because this layout cannot display the result."Below are the relevant relationship links.In my Relationship Graph there is only ONE occurrence of each of the following four tables.The TABLE:GAME is the layout I am working in. This shows the Schedule Portal and the Team_details Portal (which contains Division plus other team data). The TABLE:GAME has the following relevant fields Division, Team_Name, Gl_Team_name,TABLE:GAME TABLE: DIVISIONDivision----------------------Division nameTABLE:GAME TABLE SCHEDULEDivision----------------------DivisionGL_Team_name------------------Sched_for_Suspension (Calc field)***TABLE:GAME TABLE TEAM DETAILSGL_Team_name------------------Team_nameDivision-----------------------DivisionWhen you have a moment perhaps you would tell me what I'm missing here. Thanks!
In your second script step, you are using the current layout. You should go to the layout that contains the information from the table SCHEDULE. Then, add the record there. As of now, since you are in the current layout, you are adding a record to the GAMES table.