Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Define global variables
Topic Summary:
Created On: 14-Feb-2007 10:30
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 14-Feb-2007 10:30
User is offline View Users Profile Print this message


Vincent Osele

Posts: 2
Joined: 19-Jan-2007

I try to define some global variable. I checked this forum and found this trick: const string NUMERO_GLOBAL_VARIABLE = "globalNumero"; // create variable 'globalNumero' if (!null checkDXL "string s = "NUMERO_GLOBAL_VARIABLE";\n") { evalTop_ ("string "NUMERO_GLOBAL_VARIABLE" = \"000\";"); } I try to use it inside my dxl but the code doesn't compile unless the previous code is executed once (in standalone way). I know I could define global vars in startup.dxl but I want to simplify the install of my dxl. With startup.dxl, I must say to users ti edit this file, add an include then continue the installation of the dxl... So I try this: const string NUMERO_GLOBAL_VARIABLE = "globalNumero"; const string gNumero = "test"; // create variable 'globalNumero' if (!null checkDXL "string s = "NUMERO_GLOBAL_VARIABLE";\n") { evalTop_ ("string "NUMERO_GLOBAL_VARIABLE" = \"000\";"); } evalTop_ ("gNumero = "NUMERO_GLOBAL_VARIABLE";"); print gNumero; It doesn't work ! And if I run a second time, I have an "Internal Error, please submit a problem report" ! Is there a way to avoid modification of startup.dxl (and declare my variable of course) ?
Report this to a Moderator Report this to a Moderator
 14-Feb-2007 12:45
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi Vincent,

I think you refer to my posting here

As I have written there, the code should be inserted into Module open trigger. So it will be executed before your script starts.

The problem is in evalTop_, the code will be executed when script ends! So the variable is at least defined in second run of your script.

Another option is to place a file in startup folder in config directory - so the user s only need to place a file there instead of editing an existing one.

Greetings
Reik

-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 15-Feb-2007 04:35
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

I'm fairly sure that's not quite right: I believe when a script starts it gets all its global information and then proceeds. If that script changes the global environment then that change applies to all future scripts, but not this one since it already got its globals. If this script is on hold I believe a different script will see the global, even if the first hasn't actually finished.

But, that doesn't help much.

- Louie
Report this to a Moderator Report this to a Moderator
 15-Feb-2007 06:50
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi Louie,

what do you mean with script is on hold?
Are you talking about show (DB)?

You are right, it seems that the evalTop_ code is executed on calling show function, but that may not help you to declare global varaibles within your script?!

I think the only way of having these global variables without modifying the startup stuff is to use a trigger (open Module) - but then the global variable is first available when you opened at least one module before (open project triggers do not work anymore as you had explained in another thread).

The really usefull thing on this trigger implementation is, that it will run in an extra context outside your script, so it can finish before your script starts ...

Greetings
Reik

-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.