DXL error not undestood :DXL: <D:\XXXX.dxl:1234> Un module en cours est requis pour lopération => US traduction = operation requires a current module - ibm-doors

I have following error message :
DEBUG: isBaseline(spec_produit) = true -R-E- DXL: <D:\XXXX.dxl:1234> Un module en cours est requis pour lopération
US traduction = operation requires a current module
line 1234 is the following : print "DEBUG: baseline loaded for " name(module_in_database) " = " major(baseline_open) "." minor(baseline_open) suffix(baseline_open) "\n"
With : baseline_open = baselineInfo(module_in_database) (=true)
I don't understand why I have this message as I already use this kind of coding elsewhere with success.
Here I have the message in a loop that I use to detect if I have still open module after having close all open modules (I don't know why I still have open module but it is another subject)
the loop is :
// display list of open module at then end of the script
for module_in_database in database do
{
logResult = logResult "INFO: open modules at the end the script are " fullName(module_in_database) "\n"
// display more information on open modules : (DEBUG) :
print "DEBUG: isBaseline(" name(module_in_database) ") = " isBaseline(module_in_database) "\n"
baseline_open = baselineInfo(module_in_database)
if (baseline_open != null) {
print "DEBUG: baseline loaded for" name(module_in_database) " = " major(baseline_open) "." minor(baseline_open) suffix(baseline_open) "\n"
} else {
print "DEBUG: " name(module_in_database) " = CURRENT \n"
}
}

Version 1:
Module module_in_database
Baseline baseline_open
string logResult = ""
// display list of open module at then end of the script
for module_in_database in database do
{
logResult = logResult "INFO: open modules at the end the script are " fullName(module_in_database) "\n"
if type (module_in_database) == "Formal" then {
// display more information on open modules : (DEBUG) :
print "DEBUG: isBaseline(" name(module_in_database) ") = " isBaseline(module_in_database) "\n"
baseline_open = baselineInfo(module_in_database)
if (baseline_open != null) {
current = module_in_database // <------ set current module so that the next line works!
print "DEBUG: baseline loaded for" name(module_in_database) " = " major(baseline_open) "." minor(baseline_open) suffix(baseline_open) "\n"
} else {
print "DEBUG: " name(module_in_database) " = CURRENT \n"
}
} else {
print fullName(module_in_database) " is a Link Module. No baselineInfo available\n"
}
}
Version 2:
Module module_in_database
Baseline baseline_open
string logResult = ""
ModuleVersion mv
string version_string
// display list of open module at then end of the script
for module_in_database in database do
{
logResult = logResult "INFO: open modules at the end the script are " fullName(module_in_database) "\n"
if type (module_in_database) == "Formal" then {
// display more information on open modules : (DEBUG) :
print "DEBUG: isBaseline(" name(module_in_database) ") = " isBaseline(module_in_database) "\n"
mv = moduleVersion (module_in_database)
version_string = versionString (mv) // <---- don't use "major" and "minor", instead use version_string, which does not require a "current" module
if (version_string != "") {
print "DEBUG: baseline loaded for" name(module_in_database) " = " version_string "\n"
} else {
print "DEBUG: " name(module_in_database) " = CURRENT \n"
}
} else {
print fullName(module_in_database) " is a Link Module. No baselineInfo available\n"
}
}
P.S: Having read through our thread again, I think that the misunderstanding stems from DOORS' inconsistency when naming things. a "current version" is a Module which is not a baseline. A "current module" in DOORS-speak is a module version that is "the one '''module''' that the user currently interacts with". When you have opened five windows with modules (either current version or baselines or link modules), only one of these windows is at the front - only one of these windows catches your keyboard input - and that window contains the "current" Module. If you have a one-liner like print fullName (current Module) and you open the database explorer (main window), click on Tools->Edit DXL… and paste the code, it will complain that no Module is current. if you then click on one window and in this window click on Tools->Edit DXL…, you will get the SAME DXL window, but now the code will run, because now DOORS knows which Module is the one that you mean when you say fullName (current Module).
Unfortunately, that's still not correctly said: the current Module is not directly related to the window at the front - you might even have opened Modules invisibly. And using DXL you can say "this invisible Module is the current one" although there is a window at the front showing a different Module.
It's complicated but I hope that I explained it correctly now.

Strange.
I have been able to run the script with the following declarations
Module module_in_database
Baseline baseline_open
string logResult = ""
and I got the expected results.
I remember some problems with perms that expect a current module even though they shouldn't.
Perhaps you just need to add some lines to your loop
if type (module_in_database) == "Formal" then {
current = module_in_database
} else {
continue
}
but still, that should not be necessary

Related

Is there a way to view the last modified date of the the Object Text in DOORS?

I'm new to using DOORS and am trying to create a column/attribute that has the date of the last modification to the Object Text. I found the below code which uses "Last Modified On", but that that includes all attributes and I'm only concerned about the Object Text. Maybe there's a way to specifiy an attribute for this?
Date dMod
dMod = obj."Last Modified On"
dMod = dateAndTime(dMod)
display dMod ""
There's no such attribute on an attribute.
The only way to determine this is via the object's history. Below is the example script from DXL manual. The idea is to loop through the object's history until the history record's typeis modifyObjectand it's attrName equals 'Object Text'. Keep in mind, though, that the history in a module only goes back to the last baseline. So, you may have to browse through all baselines to find the history record you need. See Tony's "Smart History Viewer" at http://www.smartdxl.com/content/?page_id=125 for details.
// history DXL Example
/*
Example history DXL program.
Generate a report of the current Module's
history.
*/
// print a brief report of the history record
void print(History h) {
HistoryType ht = h.type
print h.author "\t" h.date "\t" ht "\t"
if (ht == createType ||
ht == modifyType ||
ht == deleteType) { // attribute type
print h.typeName
} else if (ht == createAttr ||
ht == modifyAttr ||
ht == deleteAttr) {
// attribute definition
print h.attrName
} else if (ht == createObject ||
ht == clipCopyObject ||
ht == modifyObject) { // object
print h.absNo
if (ht==modifyObject) {
// means an attribute has changed
string oldV = h.oldValue
string newV = h.newValue
print " (" h.attrName ":" oldV " -> " newV ")"
}
}
print "\n"
}
// Main program
History h
print "All history\n\n"
for h in current Module do print h
print "\nHistory for current Object\n\n"
for h in current Object do print h
print "\nNon object history\n\n"
for h in top current Module do print h

can't extract module's Version DXL IBM DOORS

I'm working on a DXL program in Doors which supposed to output to a csv file all of source module, target, linkset and version of each (source/target) modules. I've succeed to output "source module, target, linkset but I couldn't extract the version of modules. Does anyone know how to do it ?
Here is my code bellow:
The following uses an output file which is in C:\Temp, but you can easily change that.
it works by matching modules using a grep string, again which you can change to suit.
I have different module types, and therefore I can just get the results on the prefix 'STR' in this case. I decided to have multiple scripts for different prefix modules, rather than dynamically pass the STR keyword.
You need to enter your folder and subfolders for the "modPathname"
then adjust the Regexp "GrepString" to suit your naming convention
alternatively you can bypass all this by hardcoding the values.
string filename = "C:\\TEMP\\STR_Baseline_Info.txt"
Stream outFile = write filename
string Modtype = "STR"
void PrintAndOutput ( string s)
{
// print (s) // Enable if you want output
outFile << s
}
void DisplayResults( string Modtype )
{
Item modItem
Module mName
Regexp GrepString = regexp2 "^" Modtype "-[0-8][0-9][0-9]"
Folder modPathname = folder "/EnterYourFolderHere/AnySubFolders/" Modtype ""
string fullModuleName , CommentStr , moduleName
Baseline b
PrintAndOutput "------------------------------------------------------------------------------\n"
CommentStr = "This File is automatically produced via the " Modtype " Baseline Info.dxl script. \n" Modtype " Versions as of : " dateAndTime(today) "\n"
PrintAndOutput CommentStr
PrintAndOutput "-------------------------------------------------------------------------------\n\n"
for modItem in modPathname do
{
if (type (modItem ) == "Formal")
{
moduleName = (name modItem)
if (GrepString moduleName)
{
fullModuleName = (fullName(modItem))
mName = read(fullName modItem , false)
b= getMostRecentBaseline (mName)
if (b != null )
{
PrintAndOutput moduleName " -\tBaseline : "(major b)"."(minor b)(suffix b) " \t " (dateOf b) "\n"
}
else
{
PrintAndOutput moduleName " \t### No Baseline Information ### \t" " \n"
}
}
}
}
}
DisplayResults ( Modtype)

(DOORS/DXL) Modification of objects without open module

I’m working on a project with more or less 50 modules and thousands objects for module.
I need to modify the “inherit from parent” field on some objects of each module.
The one way I found to do it is to open each module and run the following dxl script I did… obviously, open all modules is a crazy solution!!!
/*
** Set_Inherit_Attribute_FALSE ***
Remove flag from the attribute "Inherit from Parent"
on each object of each module of the project
*/
// Variable definition
Object o
Module m
string serr
// file name provided by DOORS containing the results
string filename = tempFileName
print "FILE CONTAINING RESULTS - " filename "\n"
// open file in write mode
Stream outputLog = write filename
// Set current project
Project prj = current Project
print "PROJECT - "(name prj) "\n"
outputLog << "-------------------- PROJECT " (name prj) " --------------------\n\n"
// Management of each module in the project
for m in prj do {
// write in outputLog the MODULE name
outputLog << "\n**************** MODULE " (name m) " ****************\n"
// set the "inherited" to false
for o in entire m do {
// The "Inherited" has to be updated just for NOT LEAF object
if (!leaf(o)){
// write in outputLog the obj id modified
outputLog << "OBJ ID " (identifier o) "\n"
serr = specific(o)
// Check if the set of "inherited" failed
if (!null serr){
// inform the user and stop the execution
outputLog << "OBJECT ERROR"
ack "ERROR INHERITED"
// close outputLog
close outputLog
halt
}
}
}
// save modificiation on module m
save m
}
// close outputLog
close outputLog
// Inform the user the execution is ended
ack "EXECTUTION COMPLETED"
Is there a way to do the same modification without open all modules?
Thanks.
The loop 'for m in prj do' will act only on modules that you have previously opened manually in the DOORS graphical user interface.
To solve that, my modification of your code (below) loops through all items (folders, projects, formal and link modules) in each project, and opens any formal modules it finds for itself. It's important to close modules after processing, to free memory, so my modification does that, too.
/*
** Set_Inherit_Attribute_FALSE ***
Remove flag from the attribute "Inherit from Parent"
on each object of each module of the project
*/
// Variable definition
Item i
Object o
Module m
string serr
// file name provided by DOORS containing the results
string filename = tempFileName
print "FILE CONTAINING RESULTS - " filename "\n"
// open file in write mode
Stream outputLog = write filename
// Set current project
Project prj = current Project
print "PROJECT - "(name prj) "\n"
outputLog << "-------------------- PROJECT " (name prj) " --------------------\n\n"
// Management of each module in the project
for i in prj do {
if (type(i) == "Formal")
{
m = edit(fullName(i), false)
// write in outputLog the MODULE name
outputLog << "\n**************** MODULE " (name m) " ****************\n"
// set the "inherited" to false
for o in entire m do {
// The "Inherited" has to be updated just for NOT LEAF object
if (!leaf(o)){
// write in outputLog the obj id modified
outputLog << "OBJ ID " (identifier o) "\n"
serr = specific(o)
// Check if the set of "inherited" failed
if (!null serr){
// inform the user and stop the execution
outputLog << "OBJECT ERROR: " serr
ack "ERROR INHERITED"
// close outputLog
close outputLog
halt
}
}
}
// save modificiation on module m
save(m)
close(m)
}
}
// close outputLog
close outputLog
// Inform the user the execution is ended
ack "EXECUTION COMPLETED"
Also, note that your 'for o in entire m do' loop (quote from the DXL reference manual):
Assigns the variable o to be each successive object in module regardless of its deleted state or the current display set. It includes table and row header objects and the cells.
Are you sure this is what you intend?
In order to modify an object, you do have to open the module. In this case, I would be focused on closing modules after they have been checked to minimize memory load.
/*
** Set_Inherit_Attribute_FALSE ***
Remove flag from the attribute "Inherit from Parent"
on each object of each module of the project
*/
// Variable definition
Object o
Module m
string serr
// file name provided by DOORS containing the results
string filename = tempFileName
print "FILE CONTAINING RESULTS - " filename "\n"
// open file in write mode
Stream outputLog = write filename
// Set current project
Project prj = current Project
print "PROJECT - "(name prj) "\n"
outputLog << "-------------------- PROJECT " (name prj) " --------------------\n\n"
// Management of each module in the project
for m in prj do {
// write in outputLog the MODULE name
outputLog << "\n**************** MODULE " (name m) " ****************\n"
// set the "inherited" to false
for o in entire m do {
// The "Inherited" has to be updated just for NOT LEAF object
if (!leaf(o)){
// write in outputLog the obj id modified
outputLog << "OBJ ID " (identifier o) "\n"
serr = specific(o)
// Check if the set of "inherited" failed
if (!null serr){
// inform the user and stop the execution
outputLog << "OBJECT ERROR"
ack "ERROR INHERITED"
// close outputLog
close outputLog
halt
}
}
}
// save modificiation on module m
save m
Module close_mod = m
close ( close_mod )
}
// close outputLog
close outputLog
// Inform the user the execution is ended
ack "EXECTUTION COMPLETED"
If you look above, I added:
Module close_mod = m
close ( close_mod )
inside the for m in proj loop. If you ran close(m), the DXL loop would throw an error the next time it tried to assign the 'm' variable. So you end up having to declare a separate module handle and running close against that.
This should keep your memory more manageable. I would also consider running the whole thing via an 'eval_' statement, but that may not be needed.

DXL in batch mode

I am facing issues with running DXL in batch mode
doors: assertion failed, line 3173, document.cpp: !nls_("unexpected: tree root does not have a name attribute") stack:
my batch file is as below
set arg1=%1
set arg2=%2
set arg1=%arg1:"=%
set arg2=%arg2:"=%
start "DOORS" "C:\Program Files\IBM\Rational\DOORS\9.6\bin\doors.exe" -d ABCD -u xxxxx -P xxxx -b "C:\\doNothing.dxl" -dxl "string s_ModListPath = \"%arg1%\";string CRNUM = \"%arg2%\";#include <C:\\Users\\ObjectsList.dxl>"
I run this batch file from command line by passing arguments as below
C:\Users\ObjectsCmnd.bat C:\\TEMP\\ModulesSelected.txt 12345
Please suggest me what wrong I am doing and why I am getting the error
OBjectList.dxl
pragma encoding, "UTF-8"
pragma runLim,0
Buffer b_ModPath
string s_ModPath
string s_Log = "C:\\TEMP\\ObjectList.txt"
string s_OutPutLog = "C:\\TEMP\\MDPRLog.txt"
Object o
bool b1 = canOpenFile(s_ModListPath,false)
bool b2 = canOpenFile(s_Log,true)
bool b3 = canOpenFile(s_OutPutLog,true)
if(!b1)
{
print "cannot open file to read the module list \n"
}
if(!b2)
{
print "cannot open file to write the objectlist \n"
}
if(!b3)
{
print "cannot open file to write the MDPRlog under temp"
}
Stream st = read s_ModListPath
Stream Output = write s_Log
Stream Log = write s_OutPutLog
void fn_Main()
{
while(!end st)
{
b_ModPath = create
st >= b_ModPath
s_ModPath = stringOf(b_ModPath)
Module m = read(s_ModPath,false)
if(null m)
{
Log << "null module path " s_ModPath "\n"
continue
}
//noError()
current = m
if(!exists(attribute("Change_Request_ID")))
{
Log << "Attr Change_Request_ID doesnt exist in module " s_ModPath "\n"
continue
}
if(!null m)
{
//current = m
Filter CRObjects = contains(attribute "Change_Request_ID",CRNUM,false) && attribute "CC_Status" == "Frozen"
set (m, CRObjects, acceptedObjs, rejectedObjs)
filtering on
if (acceptedObjs <= 0)
{
Log << "No objects that contain CR and CC_Staus frozen \n"
}
for o in m do
{
Output << fullName(m) ";" identifier(o) "\n"
}
filtering off
}
else
{
Log << "Null module " s_ModPath "\n"
}
close m
}
delete b_ModPath
}
fn_Main()
Log << "-------- ObjectList Completed ------------- \n"
close st
close Log
close Output

How to control the Index in a for statement in DXL

For some reason the DXL interpreter does not take into account the fact that I am decrementing i at the end of the for loop. I am trying to navigate through the arrObj[] array by changing the value of "i". I have some buttons that increment(for next object) and decrement(for previous object) the value respectively. Doing the same thing with a while loop crashes the application.
Is there any way to control the index or will DXL always remember the previous value and increment it (even if the user changes it's value within the code).
Here's a snippet from my code:
for i in 0:(iTotalObj-1) do
{
sAuxType = arrObj[i]."ObjectType"
sAuxNr = number(arrObj[i]) " "
sAuxObjTxt = arrObj[i]."Object Text"
print "\nAfter FOR:"i ""
if sAuxType == "Test-Case" then
{
set(testContent,"Index number: (" number(arrObj[i]) ") -> " arrObj[i]."Object Heading" "")
set(expectedResults, " ")
fillRow(sTesterName,sCfgSW,sCfgHW,arrObj[i])
block(dtbox)
}
if sAuxType == "Test-Step" then
{
set(testContent,"Index number: (" number(arrObj[i]) ") -> " arrObj[i]."Object Text" "")
set(expectedResults,richTextWithOle(arrObj[i]."ExpectedResult"))
fillRow(sTesterName,sCfgSW,sCfgHW,arrObj[i])
block(dtbox)
}
if sAuxType == "Test-Case-Description" then
{
set(testContent,"Index number: (" number(arrObj[i]) ") -> " arrObj[i]."Object Text" "")
set(expectedResults, "Please check the description throroughly")
fillRow(sTesterName,sCfgSW,sCfgHW,arrObj[i])
block(dtbox)
arrObj[i].("TestResult " iTR "") = "n/a"
arrObj[i].("FR " iTR "") = "n/a"
}
i--
print "\nAfter DECREMENT:"i ""
}
On the output box I'll get the following:
After FOR:0
After DECREMENT:-1
After FOR:1
After DECREMENT:0
After FOR:2
After DECREMENT:1
With that type of for loop I believe DOORS is forcing i to the next value in the set. You should be able to use this type of loop instead:
for(i=0; i<(iTotalObj-1); i++) {
...
}
This loop will allow you to manipulate i inside the loop.

Resources