Roger Wilkinson 2 Posted March 1, 2021 Posted March 1, 2021 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.
David Beagan Posted March 1, 2021 Posted March 1, 2021 The &&CONNECTION value is isolated to each users session. The value one user has does not affect any other user.
Roger Wilkinson 2 Posted March 1, 2021 Author Posted March 1, 2021 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.
Manoj Chaurasia Posted March 2, 2021 Posted March 2, 2021 Roger I think running deferred is not in the same session I am pretty sure but not positive it is a separate session.
David Beagan Posted March 2, 2021 Posted March 2, 2021 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.
Roger Wilkinson 2 Posted March 2, 2021 Author Posted March 2, 2021 Awesome. Thanks David. I can use this testing to help alleviate some concerns
David Beagan Posted March 2, 2021 Posted March 2, 2021 Great. If you make any additional discoveries, please share. Thanks
Roger Wilkinson 2 Posted March 2, 2021 Author Posted March 2, 2021 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now