Jump to content

Find script on repeating field


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

Recommended Posts

Hi,

I'm having a little problem with my script. I have two repeating fields, description and cost. Each field has 10 repetitions.

I want to write a script to do a find on all 10 repeating fields in description that have something written in them and all the cost fields that have nothing in them.

Here is the script I wrote, the problem is that is only does the find on the first repeating field.

[color:blue]Enter Find Mode[]

Insert Calculated Result["Description", "*"]

Insert Calculated Result["Cost", "="]

Perform Find[]

Is there something I'm doing wrong? Please help.

thanks,

Wild.

Link to comment
Share on other sites

"Is there something I'm doing wrong?"

Yes - using repeating fields.

"The problem is that is only does the find on the first repeating field."

No, that is not the problem. The problem is that a find performed in a repeating field will always search all repeats. You simply cannot isolate repeats.

Stop using repeating fields and move to a relational desgin. You cannot do what you are trying to do. You can't individually find, delete, sort, do subsummaries, etc.

Link to comment
Share on other sites

Wild--

Welcome to the Forums. Bruce is right--the repeating field structure is strongly discouraged for the type of use you're trying to put it.

Basically, what Bruce is recommending is that you take your repeating fields, and separate that information into a separate table, one where each record stores information about a single widget (whatever it is you're trying to describe--you don't really say). The structure for this table will be something like:

table_Widgets:

WidgetID (Auto-enter Serial Number) /* This identifies the specific widget record uniquely */

ParentID (Number) /* This stores the ID number for the record in which you used to have those repeaters */

Description (Required)

Cost (Required)

You will then create a relationship between your original table's ID field, and the ParentID field, thus allowing you to show all the widgets attached to the Parent in a portal. Notice that I set Description and Cost to be required; this will help ensure that your users don't keep skipping those fields!

However, if you are trying to set up an invoicing scheme, you might consider changing things a little. Create a Products table, store the descriptions and unit price there, and then have the widgets table described above store the ProductID and a quantity entry. Your users would no longer be responsible for entering descriptions, since they'd be in the products table. Also, you could set up the Cost field to auto-enter a calculation of Quantity * Products::UnitPrice, eliminating user error there as well...

HTH,

David

Link to comment
Share on other sites

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