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

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

Recommended Posts

Posted (edited)

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 by Guest
Posted

Either loop or use the Replace command.

btw: How does manipulating a variable apply to editing 20,000 records?

Posted

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.

Posted

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.

Posted

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.

Posted

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.

Posted

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.

Posted (edited)

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 by Guest
Posted

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] ] ...

Posted

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.

  • 6 months later...
  • Newbies
Posted (edited)

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 by Guest
  • Newbies
Posted

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.

This topic is 5180 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.