Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4789 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Good Morning!

I manage quite well on my own all the time but then I run across something I really need and I can't fix so I come trotting back here <lol>. I still have my old FMP6 which I spent a lot of money on and I still can't justify upgrading; I have one database that I use a lot but that's it.

Anyway, I found one solitary FMP6 script on the web that supposedly should bring up any number of records we choose in a random manner (I have chosen 1 record). Since my db handles a word list, that means that I would be able to have FMP6 choose words for me randomly and immediately rather than my doing it myself manually all the time (as I've been doing. Very tedious and I not as easy as one would wish.)

The instructions for bringing up random records are:

2011-11-03 08:38:15 (http://help.filemaker.com/app/answers/detail/a_id/4603/~/selecting-a-random-set-of-records)

In FileMaker Pro 6 and earlier:

1.  Define a new number field called "RandomField"

2.  Define a script with these steps:

	Find All

	Replace [No Dialog, "RandomField", Random]

	Sort by RandomField [No Dialog]

	Go to Record/Request/Layout [First]

	Omit Multiple [No Dialog, 10]

	Find Omitted



To select a random set of records, run this script.

In this script, the Replace Field Contents (Replace in FileMaker Pro 6 and earlier) command replaces the

contents of the field RandomField with a calculated result. The calculated result is the Random function.  

This example finds a set of ten records.  To find a different number of records, change the number in the

Omit Multiple step.




So for FMP6 I should supposedly be able to input this:


1	Find All

2	Replace [No Dialog, "RandomField", Random]

3	Sort by RandomField [No Dialog]

4	Go to Record/Request/Layout [First]

5	Omit Multiple [No Dialog, 10]

6	Find Omitted




Whereas this is all I could do, and it doesn't work:
1	 Show All Records

2	 Replace Contents [No dialog, "RandomField"]

3	 Sort [Restore, No dialog]

4	 Go to Record/Request/Page [First]

5	 Omit Multiple [No dialog, 1]

6	 Show Omitted




I added line numbering to explain.



(The obvious one, no "Find" commands, only "Show", but fixed that and this shouldn't be cause of problem, I'm guessing.)



Line 2, no way to input something so that I get [No Dialog, "RandomField", Random], I just get [No dialog, "RandomField"].



In line 3, I only get "Sort" and can't seem to choose the field though FMP6 usu. has no problem dealing with this sort of thing.



Line 4 has slight difference in syntax wording, which don't know if that's why no go.



Each time I run the script, I have to get by this error box:
The previous script step, "Replace Contents", could not

be completed because it restores an invalid request.  Do

you wish to continue with this script?

And the end result each time whether or not I have line 4 above in to go to first request, is that I get record #1. Never varies. I get error code, whether or not I tell FMP6 to keep or replace the sort order and end up with record #1.

If I could just fix this script, this db would be nearly 100% done. So far, I've used it for everything but the final step of choosing words out of the db. With this functionality, I think that the db would no longer need working on, only finetuning.

Thanx. :)

Posted

Replace Contents [No dialog, "RandomField"]

The step should look like this:

Replace Contents [No dialog, "RandomField", "Random"]

Select the step, click "Specify…" > Replace with calculated result:, then enter the Random function into the calculation window.

BTW, you could make RandomField an unstored calculation = Random, and eliminate the Replace Contents [] step from your script.

Posted

Line 2, no way to input something so that I get [No Dialog, "RandomField", Random], I just get [No dialog, "RandomField"].

Do you mean that when you click the Specify button, all the options are unavailable? If so, then this implies RandomField is a calc (or Summary) field - change it to Number; if not, then click the Replace with calculated result option and enter Random.

This topic is 4789 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.