# Specifying a global field dynamically

**URL:** <https://forum.servoy.com/t/specifying-a-global-field-dynamically/5340>\
**Category:** Classic Servoy\
**Created:** [January 12, 2006, 8:53pm UTC](https://forum.servoy.com/t/specifying-a-global-field-dynamically/5340 "2006-01-12T20:53:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![drgibblet](https://avatars.discourse-cdn.com/v4/letter/d/50afbb/32.png) [@drgibblet](https://forum.servoy.com/u/drgibblet)\
**Post date:** [January 12, 2006, 8:53pm UTC](https://forum.servoy.com/t/specifying-a-global-field-dynamically/5340/1 "2006-01-12T20:53:31Z")

</div>

I am trying to specify a global field similar to specifying an object on a form:  
forms.Buttons\_Panel.elements[buttonpanel].text

I wanted to do something like

var buttonvar = ‘Button’ + arguments[0];  
globals[buttonvar] = arguments[0];

However, this doesn’t work. I don’t get an error, it just returns zero. If I do

globals.Button1 = arguments[0];

it returns the correct result to the global field. I assumed you could do the same with globals as you could do with forms. Is this not true? Or do I have the wrong syntax? Thanks.

Reed

---

<div class="post-metadata">

**Author:** ![ROCLASI](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/roclasi/32/4371_2.png) [@ROCLASI](https://forum.servoy.com/u/ROCLASI)\
**Post date:** [January 12, 2006, 9:10pm UTC](https://forum.servoy.com/t/specifying-a-global-field-dynamically/5340/2 "2006-01-12T21:10:55Z")

</div>

Hi Reed,

In Servoy Editor when you select the Elements node of a form you see that it has properties (allnames, length, [index], [‘name’])  
When you select the node of globals it shows no properties at all.  
So I guess it’s safe to say that what you want can’t be done.

If you really want it then you should post a feature request for it on this forum.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![drgibblet](https://avatars.discourse-cdn.com/v4/letter/d/50afbb/32.png) [@drgibblet](https://forum.servoy.com/u/drgibblet)\
**Post date:** [January 13, 2006, 6:01pm UTC](https://forum.servoy.com/t/specifying-a-global-field-dynamically/5340/3 "2006-01-13T18:01:38Z")

</div>

Thanks for the reply. It is not a big deal now but if it something I end up really needing I will post a feature request.

Reed
