# Select Global from a different module?

**URL:** https://forum.servoy.com/t/select-global-from-a-different-module/13239
**Category:** Classic Servoy
**Created:** [November 25, 2010, 12:58pm UTC](https://forum.servoy.com/t/select-global-from-a-different-module/13239 "2010-11-25T12:58:03Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Kahuna](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@Kahuna](https://forum.servoy.com/u/Kahuna)
#### Post date: [November 25, 2010, 12:58pm UTC](https://forum.servoy.com/t/select-global-from-a-different-module/13239/1 "2010-11-25T12:58:03Z")

</div>

Hi Folks, Prolly another dumb question - my speciality ![:oops:]( "Embarassed")

I have a module of the main solution where I’d like to call the rowBG global from my main solution. Seems the method selector form only lists globals from this current module?

Is there a way to call the main solution global other than creating a method to call the global, or duplicating the rowBG code in the module?

---

<div class="post-metadata">

### Author: ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)
#### Post date: [November 25, 2010, 1:14pm UTC](https://forum.servoy.com/t/select-global-from-a-different-module/13239/2 "2010-11-25T13:14:50Z")

</div>

> Kahuna:  
> Seems the method selector form only lists globals from this current module?

That’s not exactly the case. You can select any method that is part of the current module or one of the submodules referenced in the current module.

So you can only reference top-down, not vice versa

Hope this helps

---

<div class="post-metadata">

### Author: ![ptalbot](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/ptalbot/32/4952_2.png) [@ptalbot](https://forum.servoy.com/u/ptalbot)
#### Post date: [November 25, 2010, 1:21pm UTC](https://forum.servoy.com/t/select-global-from-a-different-module/13239/3 "2010-11-25T13:21:33Z")

</div>

The thing is that even if you cannot ‘see’ the globals in the code completion, you can still use them, since the solution is flattened when you use it at runtime…

But what Marc means - I know you often need a translation Ian! ![;)]( "Wink") - is that if you want to get globals code completion, you need to  
1/ activate your module (like a main solution), then  
2/ add your main solution as a module to your module (yes, this is going to be a circular reference, but it works fine), then  
3/ reactivate you main solution.

From then on, you will be able to see the globals in code completion.

Hope this helps

---

<div class="post-metadata">

### Author: ![Kahuna](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@Kahuna](https://forum.servoy.com/u/Kahuna)
#### Post date: [November 25, 2010, 1:23pm UTC](https://forum.servoy.com/t/select-global-from-a-different-module/13239/4 "2010-11-25T13:23:43Z")

</div>

> mboegem:
> 
> > Kahuna:  
> > Seems the method selector form only lists globals from this current module?
> 
> That’s not exactly the case. You can select any method that is part of the current module or one of the submodules referenced in the current module.
> 
> So you can only reference top-down, not vice versa
> 
> Hope this helps

Ahh… Marc - good point. I can see the reasoning.

Thanks

---

<div class="post-metadata">

### Author: ![Kahuna](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@Kahuna](https://forum.servoy.com/u/Kahuna)
#### Post date: [November 25, 2010, 1:30pm UTC](https://forum.servoy.com/t/select-global-from-a-different-module/13239/5 "2010-11-25T13:30:48Z")

</div>

> ptalbot:  
> The thing is that even if you cannot ‘see’ the globals in the code completion, you can still use them, since the solution is flattened when you use it at runtime…
> 
> But what Marc means - I know you often need a translation Ian! ![;)]( "Wink") - is that if you want to get globals code completion, you need to  
> 1/ activate your module (like a main solution), then  
> 2/ add your main solution as a module to your module (yes, this is going to be a circular reference, but it works fine), then  
> 3/ reactivate you main solution.
> 
> From then on, you will be able to see the globals in code completion.
> 
> Hope this helps

Thanks Patrick - but I’m not really concened about code completeion I just want to call the global from a lower (in the structure) module - but cant see how I might format the call if its not available in the method selector.

I guess globals.rowBGColor in the rowBG property of the module form wont do it - right?

BTW I’m not sure a Guy from Canada speaking French could in any way be considered a translator of Dutch English to English ![:shock:]( "Shocked") ![:twisted:]( "Twisted Evil") ![:D]( "Very Happy") especially since Marc speaks better English than I do LOL.

---

<div class="post-metadata">

### Author: ![ptalbot](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/ptalbot/32/4952_2.png) [@ptalbot](https://forum.servoy.com/u/ptalbot)
#### Post date: [November 25, 2010, 1:37pm UTC](https://forum.servoy.com/t/select-global-from-a-different-module/13239/6 "2010-11-25T13:37:05Z")

</div>

> Kahuna:  
> I guess globals.rowBGColor in the rowBG property of the module form wont do it - right?

I suppose you mean rowBGColorCalculation from the SolutionModel JSForm methods?

Then just make sure you set it to a String:

```auto
yourform.rowBGColorCalculation = "globals.rowBGColor";

```

---

<div class="post-metadata">

### Author: ![rgansevles](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rgansevles](https://forum.servoy.com/u/rgansevles)
#### Post date: [November 26, 2010, 7:44pm UTC](https://forum.servoy.com/t/select-global-from-a-different-module/13239/7 "2010-11-26T19:44:28Z")

</div>

Ian,

I think it is better to think about your module structure.  
The idea of modules is that you have some set of forms and methods that together have some defined responsibility.  
Typically you have a main solution that uses (has knowledge of) modules, but modules to be reusable, they must not have knowledge of calling solutions or modules.

If your module code is really tied to your main solution code and vv, you may consider putting all in one solution/module.  
Another way to work around this to make your main solution module of your module (which is kind of a hack, but works) so they both know of each other.  
That way you can refer to the global method in your main solution, but you module is not reusable in other solutions.

Rob
