![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
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 |
![]() |
![]()
|
![]() 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 | |
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
Yes of course. I meant persistent variables common to several modules and to all users.
Thanks again. Guillaume |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Global Variable Common to Several Modules
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.