A global field will work even when there are 0 records in your found set. You can format it with a value list and attach a script trigger to perform a script after a value is entered or selected if you need to.
Phil that is if your global field is on a table where there are records.
If the global field were on a temp table (ie his found set) where there are no records yet it wont work. Thats why I always put my Global fields in their own tables and ensure I have a single blank record in those tables at startup.
Its an oddity that you can set a global field when there are no records in the table but you cant then subsequently use it for anything. (At least that has been my experience)
Yes you can edit them I agreed
But they dont behave as you would expect when you reference them for something. Whenever I use a Global field as a portal display key and I set it when there are no records in that global field's table it doesnt work to display the records in the portal.
Yes, it won't work to display data in a portal as your portal relationship will require a current record for the layout, but it will work to drive a triggered script--say to find records or to set a value used in auto-enter calculations for each new record.
Ok I get what you are saying I modified my OnObjectModify script trigger on a global field to set another global field (in the same table) and then wrote a button script to pull the Global field values into a dialog box (even though there were no Global Field table records) it worked as you stated this is good to know.
Phil, I was doing exactly what you wrote in the first reply, but I had no luck at all getting a subsequent 'extend found set' step to find anything. With one record visible it worked fine, with no records visible it always failed. I've changed the way I deal with the problem now, so can't go back to re-test. I spent too much time on the problem and needed to move on. If I see this again I will try to make up some sample code to share. I'm wondering if it could be that when you have 1+ records visible, you don't need to force a commit, but when there are 0 visible, you do have to force a commit before you can use the field. Thanks.
I just did the following:
- Placed a global date field on the layout.
- Copied the date from a different date field on the layout.
- Used Show All Records | Show Omitted Only to get a found set of zero records
- Pasted the copied date into the global field.
- Ran this script:
Enter Find Mode 
Set Field [Table::DateField ; Table::GlobalDateField]
Extend Found Set 
It worked without any trouble to find all records with the date I pasted into the global field.