Keith M. Davie Posted September 6, 2001 Posted September 6, 2001 Entertaining a loop, part 3. The following could take about an hour to do. In the last portion you created a db file, long.fp5 (fp3). Open it now. Open Scripts / ScriptMaker. Delete the script runloop. Close Scripts / ScriptMaker. In layout or browse mode go to File / Define ... Fields. This file was created as a copy of loop.fp5. You do not need the fields no0 and no1. Delete them from Define Fields. You do need to create a field no2, Type is number. (You will enter the number 1 in this field when you are in browse mode.) Since this is a copy, you have 26 calculation fields a through z. Change them from Type calculation to Type text. Again, for those who want to do the extra work, make stime and etime fields (Type time) and a calc field (= stime-etime, Type time) and add the appropriate Set Field commands at the beginning and ending of the following script to time how long the script takes to run. This is optional. It can be a useful tool for a developer in a variety of circumstances. Format your time fields for 24 hours. There are no relationships defined for this solution. There is one script for long.fp5. The idea is to run a script which takes about 1 second. Open Scripts / ScriptMaker. Name the script getlet because we are going to clear all fields, and then through the subscripts previously written, we are going to copy the letters (get the letters - getlet) one at a time from loop.fp5 and paste them one at a time into their respective fields in long.fp5. To perform this script, like the script runloop previously, we will need only one record. The Script getlet: Enter Browse Mode [] Set Field ["stime", Status(CurrentTime)"] <!--for those who are running the time calc--> <!--clear all 26 fields--> Clear [select, "a"] Clear [select, "b"] Clear [select, "c"] ... Clear [select, "z"] <!--run 26 subscripts (in parentheses () below which designates the subscript being accessed) in loop.fp5 and paste the results in long.fp5--> Perform Script [sub-scripts, External: "loop.fp5" (copya)] Paste [select, "a"] Perform Script [sub-scripts, External: "loop.fp5" (copyb)] Paste [select, "b"] Perform Script [sub-scripts, External: "loop.fp5" (copyc)] Paste [select, "c"] ... Perform Script [sub-scripts, External: "loop.fp5" (copyz)] Paste [select, "z"] <!--the following increments a number to show that this subscript has completed in long.fp5--> Set Field ["no2", "no2 + 1"] <!--the following line is for FMPro 4 only as an inlineaction solves reporting the increment in FMPro 5--> Copy [select, "no2"] Set Field ["etime", Status(CurrentTime"] <!--for those who are running the time calc--> Go To Field [] <!--allows the time calc to perform, otherwise unnecessary--> Now you can test (Perform) the script at this point if you so desire to make sure all fields clear and then fill in. You can leave long.fp5 open. Open loop.fp5 / Scripts / Scriptmaker. We are now going to write the script which will be activated from the browser (format file's cdml -script tag command). This script runs a subscript in long.fp5 which runs the subscripts in loop.fp5. Whether running in 4 or 5, the script is to end in loop.fp5 (.fp3). Because we are running subscripts from this script, we will name this runsub. Short, no spaces, easy coding from the format file. The Script runsub: Enter Browse Mode [] Perform Script [subscripts, External: "long.fp5" (getlet)] Paste [select, no2] <!--this line is for FMPro4 only as this field does not exist in this db file for those using FMP 5--> Go To Field [] <!--again this is for FMP 4 only to make sure that the paste displays--> Pause/Resume Script ["0:00:00"] <!--this is for FMP 5 only, makes the script end here and not in long.fp5--> The number which gets incremented in long.fp5 is being started now, with the creation of long.fp5. It should increment a different number than that which is incremented in loop.fp5 by the looping script. This will help you keep track of what is occuring vis a vis the browser and script conflicts. You are now at the point where you have two database files which are connected by ScriptMaker scripts. You also have the format files to run the looping script. I will post any code changes to be made to existing format files, code for a couple of new (and brief) format files and Web Security settings in the next post.
Recommended Posts
This topic is 8548 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 accountSign in
Already have an account? Sign in here.
Sign In Now