Assuming your records are sorted in the order of play. (And not forgetting that play is circular).
Set Variable [$CurrentPlayer; Value: Get ( RecordNumber ) ]
Set Variable [$Prev ; Value: If ( $CurrentPlayer = 1 ; Get ( FoundCount ) ; $CurrentPlayer - 1 ]
Go To Record [No dialog ; $Prev]
Exit Loop If [ ( $CurrentPlayer = $Prev ) or ( Table::Bet Amount > 0 ) ]
Set Variable [$Prev ; Value: If ( $Prev = 1 ; Get ( FoundCount ) ; $Prev - 1 ]
Go To Record [No dialog ; $Prev]
If [$Prev = $CurrentPlayer]
Show Custom Dialog ["Error, no players had placed a bet..."]
Set Variable [$Call ; Value: Table::Bet Amount ]
Go To Record [No dialog ; $CurrentPlayer]
Set Field [ Table::Bet Amount ; $Call ]
Note: It seems to me that you might want to track all betting action in a related table so as to create a detailed history of each game. Thus, you might want to create a related betting table so that you could track all such activity.
Thanks for your help! I'll give this a try.
Right now each individual hand is it's own record. The players, their actions, and bet amounts, and of course the cards, are part of the HANDS TABLE, and each record.
Will your previous formula still work?
Thanks again for your help. I've read your other posts on this forum for other questions I've had and you're always the guy with the answers. Thanks for being here for us newbies with a dream, lol.
I assumed these fields were all in one table when I posted the sample script. If there is always just one Hands record per player during the game, you'll simply need to modify identifiers to refer to the correct table and field where appropriate.
They are in the same table and the same record. That's why I was wondering if the above script was still valid.
I've entered it but nothing happened. I'm sure it's an error on the way I've entered it. I apologize for asking such elementary questions but, what does the "$" do in a line of script? Does it have meaning in the script or is that a reference I should be familiar with.
Because this information is in the same record, should I be replacing the identifier of GoToRecord, with GoToField??
Thanks again for your help. I just need a little clarification on your script and I'll be on my way.
$ is needed at the start of a variable name so that you can use it in an expression such as Set FIeld [Table::Field ; $VariableName ]
That's the symbol that tells filemaker that the name refers to a variable and not a field.
What version of filemaker are you using for this? If you are using an older version that does not support variables (The script editor won't have Set Variable as a script step you can use.), you'll need to use global fields instead of these variables.
You should not be using go to field.
Each player has their own "Hand" record, correct? (If not, they should) That's the assumption I made when posting the script.
If you don't have filemaker advanced (If you do select the script debugger and run the script), insert a pause/resume step as the very first step after Loop and run the script, continuing the srcript each time it pauses. This way, you should be able to watch it move from record to record and that may give you a clue as to why it isn't working.
Thanks again for your attention. I'm using FIleMaker Pro 11.
Let me better explain the structure of my database. Each hand is it's own record. Each record consists of the hand's players, their cards, their actions, and their bet amounts. When the hand is over, a new record for the next hand is created.
Each hand starts with all six players that are at our final table, (or less if there's been an elimination). As players fold, bet, call, or raise, their actions are recorded so our editor's know the dynamics of the hand.
So if a player folds, they are done in that hand. If a player bets, the bet amount is recorded. If a player raises, that bet amount is recorded. If a player calls, I would like the most recent bet amount entered to be pasted into the bet amount field of the player that called.
I hope I explained it well enough for you, the game of poker can be confusing if you not familiar with it.
Well I think I've played poker exactly twice and neither time for real money :smileywink:
I think this will work provided you can keep only the current hand records in your found set sorted in order of play.