# JSDocs, global variables and foundsets

**URL:** https://forum.servoy.com/t/jsdocs-global-variables-and-foundsets/16278
**Category:** Classic Servoy
**Created:** [July 31, 2012, 9:51am UTC](https://forum.servoy.com/t/jsdocs-global-variables-and-foundsets/16278 "2012-07-31T09:51:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![rioba](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@rioba](https://forum.servoy.com/u/rioba)
#### Post date: [July 31, 2012, 9:51am UTC](https://forum.servoy.com/t/jsdocs-global-variables-and-foundsets/16278/1 "2012-07-31T09:51:50Z")

</div>

I have a global variable containing a duplicate foundset

```auto
scopes.globals.gb_del_fst = forms[mainFrm].foundset;

```

The foundset could belong to any one of a number of forms which refers to different tables ```  
forms[mainFrm]

```auto
The problem is that I don't know how to define the foundset in JSDoc to avoid getting a warning because there is no single db/table pair to refer to. I also tried to create the global variable on the fly using the solution model, but it doesn't help.

Any wise suggestion? Thank you.
```

---

<div class="post-metadata">

### Author: ![omar](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@omar](https://forum.servoy.com/u/omar)
#### Post date: [July 31, 2012, 11:29am UTC](https://forum.servoy.com/t/jsdocs-global-variables-and-foundsets/16278/2 "2012-07-31T11:29:24Z")

</div>

Hi,

I have reproduced a similar scenario:

```auto
/**
 * @type {JSForm}
 */
var __ActiveForm;

/**
 * @type {JSFoundset}
 */
var __ActiveFoundset ;

```

```auto
function test() {
   globals.__Foundset = forms[globals.__ActiveForm].foundset;
}

```

However, this doesn’t produce any warnings. So you must be doing something else that causes the warning? Of course this general JSFoundset type does not have any specific elements like in a normal foundset reference but that’s to be expected.

You might want to reconsider directly accessing objects from outside the object container they are located in because you will get references that might break on future changes. I would prefer to define a method in the form itself and reference that instead because then your code does know the specifics about the foundset.

Please elaborate on the details of your problem if it persists.

Kind regards,

---

<div class="post-metadata">

### Author: ![rioba](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@rioba](https://forum.servoy.com/u/rioba)
#### Post date: [August 1, 2012, 7:38pm UTC](https://forum.servoy.com/t/jsdocs-global-variables-and-foundsets/16278/3 "2012-08-01T19:38:33Z")

</div>

Thank you Omar. Probably my explanation of the problem was not very clear. As the global variable could contain any foundset from any source I was wondering how could I write the JSDocs notation not knowing in advance the db/table pair. I didn’t know that I can instead use a generic ```  
@type {JSFoundset}

```as

```

---

<div class="post-metadata">

### Author: ![omar](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@omar](https://forum.servoy.com/u/omar)
#### Post date: [August 2, 2012, 8:35am UTC](https://forum.servoy.com/t/jsdocs-global-variables-and-foundsets/16278/4 "2012-08-02T08:35:05Z")

</div>

Your welcome, glad i could help ![8)]( "Cool")

Cheers,
