Hello everyone,
I adapted a script to make the baseline comparison with layout DXL (the same script in here, versionCompare). I'd like to make the task automatic, in that I want to make a script that inserts a layout DXL column, selects the baselines through a dialog box (simply with the find command) and then performs the task of the layout DXL versionCompare in the link. I can do it manually of course, but as I am new to DXL and DOORS I would like to force myself into a more "stylish" solution, to improve my knowledge and my skills with the tool. Do you have any tips to help me with the task above? Thanks in advance for your suggestion Cheers,
Gianluca GianlucaPisano - Mon Apr 01 08:36:01 EDT 2019 |
Re: Layout DXL column by script
You have such a script supplied with DOORS in your installation. Check the DOORS DXL Library - in a DOORS module open menu item Tools / DXL Library and open "Some example programs which ....". There you find a script "Example to create a Layout DXL that shows changes to Object Text". |
Re: Layout DXL column by script I've been in this situation several times, and I found it easier to just edit the DXL as you ..err.. I deployed it. Only admins would do this and do it rarely. One problem is coding up the code that goes into the attr-DXL; it needs to be hard coded in the dialog script file, escaping all the double-quotes and slashes, or in a separate file that your dialog script dxl reads. The "Adjustable" or "Calibratable" attributes are at the top. That would look like: // MyScript.dxl compares baselines
// Change the following two variables for the specified Baseline compare
string a_NameBase_To = "" // "Current" means use the current Module |
Re: Layout DXL column by script Thanks to you both. I attach the code I did so far to better explain
/*Compare Baseline of System Requirements*/
//Script to compare two SYS.2 Baselines
DB exBox = create "System Requirements Baselines comparison"
DBE b1 = field(exBox, "SYS.2 older baseline:","",20) //put the older baseline number you want to compare
DBE b2 = field(exBox, "SYS.2 newer baseline:","",20) //put the newer baseline number you want to compare
Module m = current
void get_numbers(DB exBox) {
string s1 = get b2
string s2 = get b1
Regexp r = regexp2 "([0-9]+)\\.([0-9]+)"
if (r(s1)){
major1 = intOf s1[match 1]
minor1 = intOf s1[match 2]
}
if (r(s2)){
major2 = intOf s2[match 1]
minor2 = intOf s2[match 2]
}
print(major1"""."minor1"""\n")
print(major2"""."minor2"""\n")
string code = "#include <C:/Program Files/IBM/Rational/DOORS/9.6/lib/dxl/addins/user/versionCompare.inc>\n"//-
"int major1 = \""major1"\"\n/ //- //This part to declare variableswith baseline numbers inside the DXL layout
"int major2 = \""major2"\"\n" //-
"int minor1 = \""minor1"\"\n" //-
"int minor2 = \""minor2"\"\n" //-
"modifications(true,false,major1,minor1,"",major2,minor2,"")\n"
Column c = insert (column 2)
title(c, "System requirements baselines " major1"""."minor1"" " and " major2"""."minor2""" comparison")
width(c, 300)
justify(c, full)
dxl(c, code)
}
apply(exBox, "Get", get_numbers)
show exBox
hide exBox
The problem I have is in the declaration of the variables for the DXL code, I think. If I don't pass them in the string code, I will have a declaration error, so I have to find a way to make the function modifications able to use the major and minor numbers in input to make the comparison and put the results in the dxl column. Sorry if the script isn't well-ordered, I wrote it in a hurry to show the issue. Sorry for mistakes as well, I have just a couple of weeks of experience withdxl.
Gianluca |
Re: Layout DXL column by script GianlucaPisano - Wed Apr 03 06:03:40 EDT 2019 Thanks to you both. I attach the code I did so far to better explain
/*Compare Baseline of System Requirements*/
//Script to compare two SYS.2 Baselines
DB exBox = create "System Requirements Baselines comparison"
DBE b1 = field(exBox, "SYS.2 older baseline:","",20) //put the older baseline number you want to compare
DBE b2 = field(exBox, "SYS.2 newer baseline:","",20) //put the newer baseline number you want to compare
Module m = current
void get_numbers(DB exBox) {
string s1 = get b2
string s2 = get b1
Regexp r = regexp2 "([0-9]+)\\.([0-9]+)"
if (r(s1)){
major1 = intOf s1[match 1]
minor1 = intOf s1[match 2]
}
if (r(s2)){
major2 = intOf s2[match 1]
minor2 = intOf s2[match 2]
}
print(major1"""."minor1"""\n")
print(major2"""."minor2"""\n")
string code = "#include <C:/Program Files/IBM/Rational/DOORS/9.6/lib/dxl/addins/user/versionCompare.inc>\n"//-
"int major1 = \""major1"\"\n/ //- //This part to declare variableswith baseline numbers inside the DXL layout
"int major2 = \""major2"\"\n" //-
"int minor1 = \""minor1"\"\n" //-
"int minor2 = \""minor2"\"\n" //-
"modifications(true,false,major1,minor1,"",major2,minor2,"")\n"
Column c = insert (column 2)
title(c, "System requirements baselines " major1"""."minor1"" " and " major2"""."minor2""" comparison")
width(c, 300)
justify(c, full)
dxl(c, code)
}
apply(exBox, "Get", get_numbers)
show exBox
hide exBox
The problem I have is in the declaration of the variables for the DXL code, I think. If I don't pass them in the string code, I will have a declaration error, so I have to find a way to make the function modifications able to use the major and minor numbers in input to make the comparison and put the results in the dxl column. Sorry if the script isn't well-ordered, I wrote it in a hurry to show the issue. Sorry for mistakes as well, I have just a couple of weeks of experience withdxl.
Gianluca Updated code in the attached.
Landale Comments
You need to get your "modifications" function and insert it directly into your "code". Attachments Temp.dxl |
Re: Layout DXL column by script llandale - Wed Apr 03 22:08:09 EDT 2019 Updated code in the attached.
Landale Comments
You need to get your "modifications" function and insert it directly into your "code". Thank you for your suggestions. I managed to get the script working with your suggestions. You are right with all your observations, I wanted a first "draft" version to work quickly, as I have deadlines already scheduled in the near future, but I'm indeed going to improve the "code", adding also new features Thank you very much!
Gianluca |