Jump to content

We have a new database structure that we are going to be us...


Roger Wilkinson 2

Recommended Posts

We have a new database structure that we are going to be using whereby each Company in the organization has its own database and set of tables.

When we run a fex, we want Users to be able to multiple select what Companies they want and then it switch between each database and grab the data for each company the select.

I have my connections and the Master files set up and am setting the &&CONNECTION global variable within the fex and this is all working exactly as we need. We are building a temp table with the companies they select, looping through that temp table, setting our connection, building an output file for that companies data, appending the next companies data and so on.

By setting the Global Variable in the fex, is that specific to the fex/agent or if someone else submits another report setting the Global Variable to a different Company, will that run into the one I am running and cause issues

I am just trying to get my head around the Global Variables.

Link to comment
Share on other sites

Thanks David. So if a User submits the report Deferred with one set of parameters and then submits the report again with a different set of parameters, without exiting screen or anything, just changing parameters and clicking submit again. these would technically be running under the same session and could potentially cause an issue.
Link to comment
Share on other sites

I tried a test to see if I could force a conflict in setting a global variable between two different running fexes. First I run this one which has a delay of 10 seconds:

-SET &&CONNECTION = 'con1';

-SET &Time = HHMMSS('A8');

 

-TYPE Time=&Time CONNECTION=&&CONNECTION

 

-SET &DELAY = SLEEP(10, 'I2');

-SET &Time = HHMMSS('A8');

 

-TYPE Time=&Time CONNECTION=&&CONNECTION

 

then I immediately after, I run this one:

-SET &Time = HHMMSS('A8');

-SET &&CONNECTION = 'con2';

 

-TYPE Time=&Time CONNECTION=&&CONNECTION

 

And I see these results with timestamps showing that the second one set the global variable while the first one was still running, but didnt interfere with the value:

 

image.png2370392 13.6 KB

 

I would expect deferred run to have the same behavior, so you should be ok.

Link to comment
Share on other sites

This turned out to be a perfect test.

I added a dropdown for the Company (like this would be used in real-life) and then concatenated the Company to the output string

I ran 3 deferred reports from App Studio (didnt exit screen, just changed Company)

I ran 3 reports from an html launch page (to new Windows just changing Company)

They all kept their own individual &&CONNECTION variable even though they were running at the same times which confirms what we needed.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...