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: Global Variable Common to Several Modules
Topic Summary:
Created On: 22-Apr-2008 12:33
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.
Answer This question was answered by Guillaume Rosetti, on Friday, April 25, 2008 7:44 AM

Answer:
I just tried to solve my problem with configuration files and now it works very well ! I did not know this part of Doors.

I have created a conf file containing the maximum identifier in which I write every time I create or I delete an object.
To solve read access conflicts (2 users must not be able to read the file at the same time), I have created another conf file that I open in write mode when I want to read the first. I close the buffer when all the operations with the first file are finished. It implies that when a user wants to read the first file, he must open the second in write mode before. Consequently, it is impossible that 2 users read the first file at the same time.

Thanks for your helpful suggestion, Paul.

Guillaume
 22-Apr-2008 12:33
User is offline View Users Profile Print this message


Guillaume Rosetti

Posts: 8
Joined: 27-Feb-2008

Hello everybody

Here is my problem :

In my database I have several projects in which there is a module containing requirements.

I want to define an unique identifier for each different requirement in the database. But when a requirement is reused from a project to another, it must keep its identifier.

When I create a new requirement, I want to automatically set its identifier to the maximum of all the identifiers + 1.

To do that, I tried to add a DXL module attribute which is equal to the maximum identifier of the module. Then, when I want to create a new requirement, I calculate the maximum of all these parameters, and I add 1 to generate the new id.

It works well, but when two users want to create a new requirement at the same time, they are created with the same ID.

So I wanted to create a semaphore to solve this access problem, but I did not find an efficient way to implement this mechanism. I tried to add a module parameter named "semaphore", but changing its value requires exclusive edit mode and I want to stay in shareable edit mode.


Finally, my problem is : how to have a global counter common to several modules ?


Do you have an idea to solve my problem ?

Thanks


Guillaume
Report this to a Moderator Report this to a Moderator
 22-Apr-2008 13:19
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Well first you will need a DXL script to add a requirement which references this global "variable".

I see two ways of doing this:
Store the variable in a file on your network (so everyone can read it thats adding requirements). Just have a text file with the current number in it. When you add a new requirement with your tool, it can read the number, increment it and then overwrite the old file with a new one containing the incremented number.

You could also just have a separate module containing this variable. Or better yet, a module containing some information on all your requirements. You could write some DXL to create this module from the requirements you have and the ID number would be the Object ID of objects in that module. Then when a requirement is added with your tool, it gets the next absolute number from this module, gets the requirement information from you, then adds the requirement in both the module you want to put it in and the requirement "database" where the IDs are all at.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com

Edited: 22-Apr-2008 at 13:20 by David Pechacek
Report this to a Moderator Report this to a Moderator
 24-Apr-2008 08:31
User is offline View Users Profile Print this message


Guillaume Rosetti

Posts: 8
Joined: 27-Feb-2008

Thanks for your answers David.

I think I will opt for the first solution, because the second is too heavy in my case.
It is a shame not to be able to declare global variables into Doors... it can be useful sometimes !

Have a nice day.

Guillaume
Report this to a Moderator Report this to a Moderator
 24-Apr-2008 12:43
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

You can have global variables but the value would be lost each time the client is closed. I mean with the file idea, you could have a startup script that declares the global variable and gets the last saved value from the file. Then have a script that runs when DOORS is closed and saves the current value of the variable back to the file.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com

Edited: 24-Apr-2008 at 13:07 by David Pechacek
Report this to a Moderator Report this to a Moderator
 24-Apr-2008 12:52
User is offline View Users Profile Print this message


Guillaume Rosetti

Posts: 8
Joined: 27-Feb-2008

Yes of course. I meant persistent variables common to several modules and to all users.
Thanks again.

Guillaume
Report this to a Moderator Report this to a Moderator
 24-Apr-2008 12:59
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

How about using a configuration file? See 'Configuration file access' section of 'General language facilities' in the DOORS Scripting manual. At least, that's where it is in the 7.1 Manual...

Try the index, and look for perms beginning 'conf'.

Paul.

-------------------------


Paul dot Tiplady at TRW dot com
TRW Automotive
Report this to a Moderator Report this to a Moderator
 25-Apr-2008 07:44
User is offline View Users Profile Print this message


Guillaume Rosetti

Posts: 8
Joined: 27-Feb-2008

Answer Answer
I just tried to solve my problem with configuration files and now it works very well ! I did not know this part of Doors.

I have created a conf file containing the maximum identifier in which I write every time I create or I delete an object.
To solve read access conflicts (2 users must not be able to read the file at the same time), I have created another conf file that I open in write mode when I want to read the first. I close the buffer when all the operations with the first file are finished. It implies that when a user wants to read the first file, he must open the second in write mode before. Consequently, it is impossible that 2 users read the first file at the same time.

Thanks for your helpful suggestion, Paul.

Guillaume
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.