Jump to content

Cross-file global values for searching


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

Recommended Posts

I have one file, Invoicing, that has two global search fields (NumSearch and CodeSearch). The file has a working script, Invoice Search, that uses these global values in several fields to find an Invoice that has a range of Num values that incorporates the NumSearch value. More specifically, each Invoicing record has ten StartNum and ten EndNum fields (StartNum1, EndNum1, StartNum2, ...). The Invoice Search script finds any record on which the Code value matches CodeSearch and one of the Num ranges includes NumSearch. I don't know if all that makes sense, but that part is working.

What I want to do is have the user be in a different file, Items, for which each Item has one Code and one Num. The user will click a Find Invoice button, and the Invoice Search script should run with the global search fields set to the Code and Num values from the currently viewed Item record.

Normally I would use an Insert Calculated step, but I can't think of a way to relate the Items file to the Invoicing file. Without a relationship, I can't point any script steps to any field in the Invoicing file, including the globals.

As Item records are generated, the Invoice that includes them is unknown, and so I can't relate an Item to the Invoice that included it. It's unrealistic for me to create an Invoicing record for each Item, since hundreds of thousands of Items are invoiced (hence the number ranges), while only thousands are entered into the Items database when they are returned at some later date.

The best approach I can devise would be a way to relate Items::Num and Items::Code to the global fields Invoicing::NumSearch and Invoicing::CodeSearch, but I'm uncertain as to how to design this so I can copy the values from the two Items fields into the two Invoicing fields.

Thanks in advance for any help!

Link to comment
Share on other sites

I'm not sure I follow all that. If the question is "How do I pass global values from one file to another?" the answer is:

Create a field in each file:

iOne (calculation, number, indexed) = 1

(we started using "iOne" as the name during the iMac introduction!)

Relate the two files by iOne <---> iOne (call this relationship "Constant")

Since globals only exist once per file (not once per record as normal field) the fact that every record in one file matches every record in the next doesn't matter. Don't use this relationship with normal field!

Then to do a find:

Enter Find Mode

SetField(dummy1, Constant::gField1)

SetField(dummy2, Constant::gField2)

Perform Find ()

-bd

Link to comment
Share on other sites

Aha! I saw one one other posting of yours that hinted at this from last year, but the original question was unclear so I didn't get it at the time. Basically, the two related fields (iOne) are dummy fields that are used to create the relationship for access between real fields, right?

That should fix it perfectly. Thanks!

Link to comment
Share on other sites

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