how can i use another module's variable?

how can i use another module's variable?

  

Hello,


there's 2 module in our outsystems server.

so let's say module A, B

Module A has text variable called a-a.

in this case how can i use or load it on module B?

Hi dong-seop,

You can not share variables across modules. 

But let me ask you, what kind of variables are you talking about? Session variables, Site properties or others?

Cheers,

José

José Costa wrote:

Hi dong-seop,

You can not share variables across modules. 

But let me ask you, what kind of variables are you talking about? Session variables, Site properties or others?

Cheers,

José

Thx for quick respond.

Actually i'd like to develop a workflow system used in company.

So i'd like to save all company information like department, employee name, phone number into the one module.

And from another module, whenever i want to use it, i wana use from that module


Hi Dong-Seop,

Are you going to use OutSystems workflow engine? You should read a bit more about BPT or maybe even follow the online training.

The information you describe seems to be better stored in a database (Employee information, along with department data etc...) and in that case you can make those entities available between Modules by marking the Entity as Public, and referencing it in the consumer module

Hi dong-seop,

In that case I would save that information in an Entity (database table). And entities you can create them in one module and use them in the other.

You can see how that works by doing the first lessons in this course:

https://www.outsystems.com/learn/courses/15/developing-outsystems-web-applications/

Cheers,

José

Solution

Hi,

Another way to do it is to use getter actions.

You can create a public action in your first module that simply returns the value of, say, a session variable, and then use that action in every other module where you might need that information.

An example:

In the project I'm currently working, the user can select the company he's working with from a drop down box in the header of the application.

This header is a web block in a shared module, let's call it module A, and as such the variable that holds the company id is defined in that module.

Then, when another module, let's call it, module B, uses the web block to let the user change the company and then needs to know what company was selected, it simply uses the GetCompanyId public action from module A.

And when the user navigates to module C, when this module needs to know the company id, it too uses the GetCompanyId public action from module A.

Hope this helps!


Solution

Hey,


I guess the best way to accomplish this is to make a Core Module ( like a DataAccess ) that contains all Entities needed for example Department and Employee.

Just add that Core Module to module A and B dependencies.

Then, in module A you insert the information in the desired entities.

And from module B you access to that information.

I believe that is the better way if you want to manipulate multiple data from different modules.


Cheers 

VC