![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Write to file Topic Summary: Writing attribute values to a file Created On: 7-May-2008 19:24 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
I am modifying an existing dxl to do the following:
1)Search modules for a defined value in an attribute 2)Count the number of objects that contain that criteria 3)Display the path, module name, number of objects, and object identifiers of those objects. The attached code displays the module name, identifier, and counts how many objects there are in the DXL window. It also creates and .xls file and captures the path, module name, and number of objects. What I want it to do is to list the objects after it reports the number of objects. The problem is below, it doesn't like the string reqnum in that section. /*Section to write to file */ wfile << pathName "\t" moduleName "\t" reqCount "\t" reqnum "\n" I am assuming I will need to create a buffer, but I don't exactly know how to do that. Any help is much appreciated. And keep in mind, I am not a skilled programmer, so I have to muddle my way through this stuff. Thanks, Corey Edited: 7-May-2008 at 21:34 by Corey Carroll |
|
![]() |
|
![]() |
|
It doesn't like the variable reqnum because you never assign it to anything so its null.
And you can't just write out an .xls file using a stream. Excel files have a file header. Write to a .csv file which can be opened in Excel since you're already separating data by tabs. ------------------------- David Pechacek AAI Services Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com |
|
![]() |
|
![]() |
|
Originally I was using a .csv, but one of my iterations didn't like writing to that file, so I changed it to an .xls. I re-attached the code to the origianl post. I missed a few things when I did a cleanup before I posted. Even when I define reqnum = identifier (o), it doesn't like it. I will keep playing with it.
|
|
![]() |
|
![]() |
|
You have two 'reqnums'. The 'string' in the outer context is never assigned to anything. The 'Buffer' on in inner context is never deleted. By the time you are writing 'reqnum' at the bottom, the inner context is finished so you are trying to print a variable that has never had a value; no doubt you are getting 'undefined variable reference'.
Add 'reqnum = ""' at the top. Delete the Buffer reqnum. delete 'tempStringOf'. That should do it. Actually, by the time you are printing at the bottom, what's the point of printing the last object in the module's ID? - Louie |
|
![]() |
|
![]() |
|
DOORS doesn't care what you're writing to with a stream. It opens it as a text file and writes to it. What matters is whether or not you're writing the file properly for what application it will ultimately be opened with. If you had a problem writing out to a csv file, it wasn't that the csv file didn't like it, there was some problem with your DXL.
Edit: And actually I just realized that you're separating data with tabs, not commas. Use the tsv extension. When you open it with Excel you can choose to load the data into excel using the tab character as a delimiter. ------------------------- David Pechacek AAI Services Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com Edited: 8-May-2008 at 14:28 by David Pechacek |
|
![]() |
|
![]() |
|
Thanks everybody...I haven't had time to work on it lately, but will pick it back up soon.
Concerning the tabs, I wondered myself about that. The code I used to build upon was set up that way...and for some reason opens in .csv just fine. I will change it and keep everbody posted on my progress. |
|
![]() |
|
![]() |
|
The code below is a summary of all the suggestions above. The only issue is that in the .csv file, it only displays the identifier of the last object in the module. I wanted to list the identifier for all objects that meet the criteria. How is this done, or am I asking too much of DXL?
Thanks, Corey |
|
![]() |
|
![]() |
|
You can accumulate all the ReqNums with the outside buffer we just told you to delete. Something like attached.
- Louie |
|
![]() |
|
![]() |
|
I'm getting the following error:
null buffer parameter was passed into argument position 1 ...in reference to the following line: if (length(bufAllReqNums) == 0) What does this mean...I can't figure out how to correct it. |
|
![]() |
|
![]() |
|
It means the buffer is set to null.
So for some reason you either directly set bufAllReqNums to null or something returned null into bufAllReqNums. ------------------------- Scott Boisvert Engineering Tools Administrator L-3 Communications - Avionics Systems scott.boisvert@l-3com.com |
|
![]() |
|
![]() |
|
You may be getting this error because you deleted bufAllReqNums
Example script demos the problem and the error Buffer bufAllReqNums=create delete bufAllReqNums if (length(bufAllReqNums) == 0) print "Ok" |
|
![]() |
|
![]() |
|
Thanks to all for the help! The attached code is everything so far, and it works. I'm still trying to work out the kinks. Trying to get the IDs printed after the module information, as opposed to before. Also trying to get it to not print the module info if the ReqCount = 0. Next will be working in a GUI to let the user define what needs to be reported!
Thanks again for all the help! |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Write to file
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.