4 Replies Latest reply on Aug 11, 2015 11:00 AM by PeterTipold

    Script to control the current record



      Script to control the current record


      This is my first post.

      I have a script that finds a group of say 40 records, sorted alphabetically (call it Script A). I need the user to go through each record one at a time and enter some information into two fields. However, after they enter in the information for the current record, they need to go to Script B and then return to the next record in Script A. The user needs to toggle between Scripts A and B until they have entered in the information for each of the 40 records. Each time they enter in information in a record in Script A, they need to go to Script B.

      My problem is that when I return to Script A, FMPro 14 always takes me to the first record. I can't get it to advance to the next record. In other words, I can't set the current record in Script A as the last record changed. I tried "Go to Record/Request/Page" in Script Workspace but that only takes me to the First or Last record. Is there any script step that can solve this problem?


        • 1. Re: Script to control the current record

          Well what does script B do?  I also don't understand the toggling between A & B, and returning to Script A.  Please provide some concrete details of what is going on.

          In the meantime, you can open another window, of the same layout, and retain the same found set, do what ever is in script B, close the window.  You don't even have to show the window.

          • 2. Re: Script to control the current record

            Thanks for the response, Steve. This data base is for a baseball draft. The data base contains all players in the draft, one record for each player. Script A extracts all players in one position, say all First Basemen, sorted alphabetically by name. Each First Baseman is drafted one at a time, alphabetically. Script B is a summary of all players who have been drafted, sorted by each team in the draft. All drafting teams need to see this summary to know what players are on each drafted team. They need to see this screen after each player is drafted. I hope that helps. In the meantime, I'll try your recommendation out.

            • 3. Re: Script to control the current record

              Without knowing all the details,  I would think I would have my main screen show the results of 'Script B' in list view, with a check box for drafted (checked)  The undrafted players by position would be formed on a popup as a list view.  As a player is drafted, I would use a script that freezes the window, simply checks the drafted box, omits them from the popup, then if need be refreshes the main layout (sort script).  Now the main layout refreshes to drop the player in the right spot, on the right team, and the pop up would pop back up with the new list of undrafted players.

              What tables do you have, and how are the relationships set up?

              Once again I'm just guessing.

              • 4. Re: Script to control the current record

                Thanks again for your feedback, Steve. Your solution sounds very slick. I was going at it a little simpler.

                We have 8 positions that we draft -- Catcher, First Base, Second Base, Shortstop, Third Base, Outfield, Starting Pitchers, Relief Pitchers and actually, it is an auction. One of the positions is chosen at random and then all of the players within that position are auctioned off alphabetically. As each player is auctioned, all of the 11 teams must see a summarized table of all of the drafted players and their auction values, grouped by each team for all of the draft teams. Each team can spend a maximum of 250 draft dollars and they can only draft a maximum of 25 players. They must draft at least 2 middle infielders (2nd or SS), at least 2 corner infielders (1st or 3rd), at least 3 Outfielders and at least 5 Pitchers. So we must be able to see each player's position. As well, we must be able to see each team's draft dollars remaining and the number of players remaining. I have calculations for these.

                Currently, I have my data base set up as a Main Menu, which has a button for each of the draft positions as well as the summary screen of each team's drafted players. Once we pick the position to be drafted, we would click the appropriate button (eg. First Base) and each First Baseman would come up one at a time, one record on the screen. As the auction proceeds, we would input the Draft Value and the team number that drafted the player. Then we would toggle to the summary screen of each team's drafted players with their draft dollars and players left. When First Base is done, we choose another position until all 8 positions are complete. It would be slicker to have everything on one screen so that we wouldn't have to toggle back and forth. If I went to one popup for each position, I would have to be able to input the draft value and the team number who got the player.