Jump to content

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

Recommended Posts

Posted

I need help understanding the form and function of global fields. When I look at the field definition box, I see a list of 'fields' which all apply to EACH record - and each will/may have a different value specifically addressing that ONE RECORD. However, a global field (and some calcs) apply to ALL records, right? This is where my vision fuzzes.

The question is: How can I use a global field to 'hold' data that only applies to one specific record? I thought any value in a global field would equally apply to ALL records and display the same value for EVERY record in a db??? It makes sense to use a global as a temporary storage area (hold placard) for data, before writing it to a permanent data field for a specific record -- but I wouldn't want to LEAVE data there, would I? I sure hope this question made sense and that someone can 'walk me through' the thinking of it. smirk.gif

Posted

By definition, a global field applies to no particular record. This is always the case. Summary fields also apply to no particular record (as they aggregate data across the whole file).

All other field types, including calculations, always apply separately to every record (though depending on their formula, some calculations can be set up to have the same value on every record - the most common example being 'constant' key fields with a formula of "1" - but they still store a separate 1 for every record!).

The question is: How can I use a global field to 'hold' data that only applies to one specific record?

You can't. By definition, any field which simultaneously holds a different value for each record is not global. But that doesn't stop you from transferring a value from a record to a global field (where it will then be 'seen' from all other records).

Globals can be used as temporary storage. They are particularly useful for taking values between records (like a kind of clipboard) in scripts, or even between files (using constant relationships). Eg write a value from a particular record to a global field, go to another file and retrieve that value - the records may not be related but you can use this technique to script a 'transaction' between them anyway.

Global fields can also hold universal reference data (which has to be put there on the host or when the file is in single user mode in order for it to be saved when the file is closed) such as layout labels or button graphics or any other literal or constant values. This is a very common role they perform.

Posted

Just to add a bit to one of Ray's (consistently well written, by the way) explainations. We generally don't use globals to store settings that change in multi-user solutions (last check number, current printer, etc.). For these sort of "Preferences", general practice is to create a Preferences file with a single record (and protection to prevent creation or deletion of this record) and store the settings in non-global fields.

-bd

Posted

Thank you for that additional information. Although I'm not even close (probably 8 months away) from networking, if I got in the habit of using it for those items, it could cause problems for me then. I will add this information to my networking piece.

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