Parts of what you describe do not make sense. Other parts might by scripted in more than one way. I recommend posting your script.
To post a script to the forum:
- You can upload a screen shot of your script by using the Upload an Image controls located just below Post a New Answer.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
- If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
Phil you lucky devil, you are stuck with me again.
I have it uploaded. I was able to use the script you helped me with to get this to work.
I almost never use a script step starting with the word "insert" except to insert files into container fields. Set Field is 99/100, the better option.
Your script only modifies at most two records and does nothing to Find the first record being modified
Can you explain in more detail what you are trying to do here?
I am putting the winner of a game into a field and then have FM find all the records with the winning team. Then go to another field and insert a 1 (for the correct pick). Then show all the records with the other team and put a 0 in the field. Then go to another field for game 2 and do the same thing.
Here are the fields:
Game #1 pick goes in field WPS#1. The winning team is placed in Win#1. FM finds all the matches and goes to G1 and puts a 1 in it. Then it shows all omitted members and places a 0 in G1. Then of course it will go to game 2 and do the same thing.
I thought I had a problem with it not being told to go to the first record.
This is the other script that runs after the one you already have.
and then have FM find all the records with the winning team.
But no part of your script finds any records.
Your right but that is what it does in the script "Winners". Then it runs this script. I could make them one but this is just how I did it.
I can click on "Show all records " in the menu and it does it. I just don't understand why it doesn't when I put it in the script.
I have made the changes you suggested.
Yes, but by only posting this small script you leave me in the dark about how you are trying to do this.
Assuming that your script correctly finds the record, the first part makes sense, but unless there are only two records in your table, this part isn't likely to produce correct results:
Show Omitted Only
Say you have 25 records in your table. The script that you did not post finds a record and this script changes the value of a field in the found record. Then show omitted only pulls up a found set of 24 record--all the other records in your table. And there is a very good chance that the above two script steps will thus modify data in the wrong record as you have a 1/24 chance of having the correct record as the current record.
I'm sorry Phil I thought I sent the first part. I'm attaching it to this.
There are 16 games so I will have to do this 16 times - not a problem once I get it to work.
Am I correct in assuming that if I told it to do another search without showing all records it would only search the found records?
I could skip putting 0's in the omitted records. That would save a few steps.
Now I'm finding that if FM only finds one record containing what the script is looking for, it will not "Show all records". If it finds two it works.
Show All record always works. But if you are trying to put the same value into more than one record after the Show Omitted Only, your script can't do that, it only modifies a single record. If you want to put a 0 into that field for all records in the found set, use Replace Field Contents.
I have changed it to "replace contents" and dropped putting the 0's in the field. What do I use in place of "Show all records"?
Do I need to show all records to have it search the entire db? I'm going to try it without using show all records and see if it works.
I got it working. I'm attaching the script.
I would put the Set Error Capture step at the beginning of your script. However, if you're not going to trap for errors it makes little difference other than you not ever knowing what errors were thrown.