Global Vars 
Author Message
 Global Vars

I've found a oddity when using Global variables with FM5. I use several
of them as temp storage for some of the scripts that I have written.

My global vars are called "gVar1" and "gVarNum1" (the first is text, the
second is a number).

The script command Set Field ["gVar1","UserName"] only seems to work
properly IF gVar1 is available on the actual layout. If I remove the
gVar1 field from the layout, it doesn't copy the text from UserName
field.

This seems rather goofy to me since I want to use globals as temp
storage and don't need them displayed. I can't find anything in the
manual that says that you need to have a field on a layout in order to
use (get stuff from it, or put stuff into it).

Someone clear this up for me?



Sun, 24 Aug 2003 03:44:13 GMT
 Global Vars

Hi Mel -

Assuming that by Global variable you mean Global field (FMPro doesn't
support global variables), that's pretty odd.  It works fine for me.
Perhaps there is something else messing your process up.  Is your solution
relational?  Is it possible that when you are in a different layout, it's in
a different database?  Please post some more detail (your entire script?), I
or others in the group would be happy to help but I don't think we have seen
this behavior before.

Thanks -
James

Quote:

> I've found a oddity when using Global variables with FM5. I use several
> of them as temp storage for some of the scripts that I have written.

> My global vars are called "gVar1" and "gVarNum1" (the first is text, the
> second is a number).

> The script command Set Field ["gVar1","UserName"] only seems to work
> properly IF gVar1 is available on the actual layout. If I remove the
> gVar1 field from the layout, it doesn't copy the text from UserName
> field.

> This seems rather goofy to me since I want to use globals as temp
> storage and don't need them displayed. I can't find anything in the
> manual that says that you need to have a field on a layout in order to
> use (get stuff from it, or put stuff into it).

> Someone clear this up for me?

--
Don't forget to remove the obvious spam block when replying.
I advocate making an address book entry and using it!  Thanks!


Sun, 24 Aug 2003 04:48:50 GMT
 Global Vars


Quote:
>I've found a oddity when using Global variables with FM5. I use several
>of them as temp storage for some of the scripts that I have written.

>My global vars are called "gVar1" and "gVarNum1" (the first is text, the
>second is a number).

>The script command Set Field ["gVar1","UserName"] only seems to work
>properly IF gVar1 is available on the actual layout. If I remove the
>gVar1 field from the layout, it doesn't copy the text from UserName
>field.

>This seems rather goofy to me since I want to use globals as temp
>storage and don't need them displayed. I can't find anything in the
>manual that says that you need to have a field on a layout in order to
>use (get stuff from it, or put stuff into it).

>Someone clear this up for me?

Just in the event anyone has found this, I tracked it down.

I was running a subscript from the script. I needed a way for the
subscript to tell the main script that I had made a change. So I simply
zero'd the global variables and then checked them in the main script. If
they were empty, I knew I have made a change in the subscript. If they
still had something in them, I knew that for "some reason" I hadn't made
a change.

For whatever reason, even though the data was modified in the subscript
and the global vars were emptied, FileMaker never got the changes made
by the subscript returned to the layout. UNLESS I had the global
variables actually on the layout.

To me, it obviously has something to do with the way that FileMaker
updates its own records internally. Perhaps that's all done at Screen
Refresh or something.

It would be nice if there was a way to return an argument from the
subscript (even a flag Zero/Non Zero). I'm now doing it with a global
var that will basically hold a true/not true value. Awkward from a
programmers standpoint, but it works.



Sun, 24 Aug 2003 07:18:21 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Set DTS Global Vars from Select Statement?

2. unable to create DTS global vars of type currency

3. Global Vars for Pkg that executes another Pkg

4. Global vars back to parent

5. static or persisten global vars?

6. Global vars/execute task confusion

7. ExecutePackageTask - Dynamically setting the inner global vars

8. Passing GLobal Vars to Inner package

9. Global vars

10. DTS Package - Global Vars

11. Loginscript, global vars

12. Global vars


 
Powered by phpBB® Forum Software