March 6, 201015 yr I am working on a database with 20,000 records. I have written a script that performs an action that I need to apply to about 15,000 of these records. What do i have to do with the script to apply it to a set of found records. Currently I have a button that I use on the records as I access them, but I would prefer to apply it to all the records that I need to at once. Thanks. PS: The script currently takes 9 values from 1 repeating variable and places those 9 values in 9 separate variables. Edited March 6, 201015 yr by Guest
March 6, 201015 yr Either loop or use the Replace command. btw: How does manipulating a variable apply to editing 20,000 records?
March 7, 201015 yr Author Can you elaborate, please? How do you loop a script across multiple records? Can you show an example of a script? My script currently replaces the values of several variables on a single record, what process would you use to propagate it across multiple records? Thanks for the help.
March 7, 201015 yr You are mixing up terms. Values in fields are not variables. Please look to FM's help for examples of looping scripts, and the Replace command.
March 7, 201015 yr Author Correct me if I am wrong, but values are assigned to variables across records. I want to change the values in multiple records that are assigned to these variables. I'm not sure what I have mixed up. Let me make a super simple example so that you might be able to illustrate to me how it is done... Lets say I have a variable called "X" and three records. In those records that variable is assigned the value of 1, 2, and 3. If I want to create a script that performs a calculation, say multiply them by 3, how would I do this automatically with a script for all three records at once and result in those values being 3, 6, 9. Thanks for the help.
March 7, 201015 yr You are being corrected: a table has records (rows) and fields (columns). Values specific to a record are stored in fields. Variables are used in scripts and calculations, but a variable is not specific to a record.
March 7, 201015 yr Author Yes, values are in records, but each value is tied to a variable that I use in my script. You can't have a value without first defining a variable. If I want to change a value in multiple records I need to apply it in the script to a variable, hence changing all the values... I'm not sure how I can better describe this.
March 7, 201015 yr Author OK, I see the issue with my question... As far as filemaker terminology a I am wording the question poorly... A field is a type of variable in a pure programming sense "...a variable is a facility for storing data. The current value of the variable is the data actually stored in the variable. Variables in programming do not directly correspond to the notion of variables in mathematics." Let me rephrase the question in the Filemaker vernacular. If I want to modify the value of fields across multiple records how would I achieve this. Edited March 7, 201015 yr by Guest
March 7, 201015 yr hello if I translated The script currently takes 9 values from 1 repeating variable and places those 9 values in 9 separate variables. into The script currently takes 9 values from 1 repeating field and places those 9 values in 9 separate fields. as others said, you can perform a script with : Replace Field Contents [ No dialog; field1; Replace with calculation: repeating_field[1] ] Replace Field Contents [No dialog; field2; Replace with calculation: repeating_field[2] ] ...
March 7, 201015 yr Author Thanks, Replace Field will work... Sorry for the confusion, but in all the other programming languages I've worked in a field is a box with no intrinsic value, and a variable would behave just like a field would.
September 16, 201015 yr Newbies Could someone please enlighten me as to how to use the replace contents in this situation... 1. I have a set of invoices which on creation have some set field values (ie. payment due date, status (pending, overdue, closed), a countdown to payment and paid (yes or no)). 2. If the invoices is "payed" the countdown is set to n/a and the status is set to "closed". If the invoice is "unpayed" the countdown is set to the number of days till payment and the status is set to "pending". If countdown is a negative value the status is set to "overdue". 3. I have a series of scripts which review these conditions and set the fields accordingly. 4. I want that set of scripts to run against all records in the file so that a report can be made of all pending and overdue invoice payments. 5. When the database is opened I want all records to be reviewed and altered accordingly so that everything is up to date. Thanks in advance, Michael Edited September 16, 201015 yr by Guest
September 18, 201015 yr Newbies I've built a loop function into the script which cycles through all of the records in the found set and then completes the report. No worries for now.
Create an account or sign in to comment