Merging Attributes on Word Export

I am having a similar problem to the thread in the link below:

Link: http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14527751

Although my problem is slightly different, as I am trying to properly locate the section on the export where I can properly merge two attributes together on the export in to word as this needs to be in book style export.

My first couple attempts gave me too many errors but my latest attempt provided the following error output with I tried to run the DXL. If anyone can provide any assassinate it would be greatly appreciated. I have attached a copy of the Modified default Word Export DXL, that I have been trying to modify and below is the code I inserted in a location I thought it should be. This code I added is in the attached file also.

Recent Errors
-E- DXL: <Line:2668> incorrect arguments for (>)
-E- DXL: <Line:2669> incorrectly concatenated tokens
-E- DXL: <Line:2669> incorrect arguments for function (wordDumpObjectVBA)
-E- DXL: <Line:2668> incorrect arguments for (if)
-I- DXL: All done. Errors reported: 4. Warnings reported: 0.
 

if (o."Attribute 1" > "XYZ."){    // **** User Mod Start ****
                wordDumpObjectVBA(o."Attribute 1" " " o."Object Text")
                exportStepProgress
                }
                else { // **** Mod End ****
                wordDumpObjectVBA(o)
                exportStepProgress
                } // **** remove this bracket if this dosnet work. ****

 


Again Any assistance is appreciated as the DXL help has nothing on the wordDumpObjectVBA function.

 


SystemAdmin - Tue Mar 19 12:19:40 EDT 2013

Re: Merging Attributes on Word Export
llandale - Tue Mar 19 14:24:30 EDT 2013

Add double-double quotes to force reading the attr-value.
  • (o."Attribute 1" ""> "XYZ.")

This:
  • o."Attribute 1"
is not a variable of type "string"; it is type "Attr__".
You are allowed to do this:
  • string s = o."Attribute 1"
because there is an "=" perm that converts "Attr__" to a string by actually reading the attr-value. (Or bool or int or real).
This is indeed a string:
  • o."Attribute 1" ""
because there is a concatanate perm that between "Attr__" and "string", which reads the attr-value and converts it to a string.

-Louie

Re: Merging Attributes on Word Export
SystemAdmin - Tue Mar 19 15:44:38 EDT 2013

llandale - Tue Mar 19 14:24:30 EDT 2013
Add double-double quotes to force reading the attr-value.

  • (o."Attribute 1" ""> "XYZ.")

This:
  • o."Attribute 1"
is not a variable of type "string"; it is type "Attr__".
You are allowed to do this:
  • string s = o."Attribute 1"
because there is an "=" perm that converts "Attr__" to a string by actually reading the attr-value. (Or bool or int or real).
This is indeed a string:
  • o."Attribute 1" ""
because there is a concatanate perm that between "Attr__" and "string", which reads the attr-value and converts it to a string.

-Louie

Ok, that helped but now I still have a problem with the wordDumpObjectVBA. Unless I misunderstood some of the previous information you provided. Here is the new error and the updated modified code per the previous comments.

Error:
-E- DXL: <Line:2670> incorrect arguments for function (wordDumpObjectVBA)
-I- DXL: All done. Errors reported: 1. Warnings reported: 0.

if (o."Attribute 1" ""> "XYZ."){    // **** User Mod Start ****
                string temp = o."Attribute 1" ""  " " o."Object Text" ""
                wordDumpObjectVBA(temp)
                exportStepProgress
                }
                else { // **** Mod End ****
                wordDumpObjectVBA(o)
                exportStepProgress
                } // **** remove this bracket if this dosnet work. ****

 


Again thanks in advance for the input, it is very much appreciated.

 

Re: Merging Attributes on Word Export
SystemAdmin - Tue Mar 19 16:36:31 EDT 2013

SystemAdmin - Tue Mar 19 15:44:38 EDT 2013

Ok, that helped but now I still have a problem with the wordDumpObjectVBA. Unless I misunderstood some of the previous information you provided. Here is the new error and the updated modified code per the previous comments.

Error:
-E- DXL: <Line:2670> incorrect arguments for function (wordDumpObjectVBA)
-I- DXL: All done. Errors reported: 1. Warnings reported: 0.

if (o."Attribute 1" ""> "XYZ."){    // **** User Mod Start ****
                string temp = o."Attribute 1" ""  " " o."Object Text" ""
                wordDumpObjectVBA(temp)
                exportStepProgress
                }
                else { // **** Mod End ****
                wordDumpObjectVBA(o)
                exportStepProgress
                } // **** remove this bracket if this dosnet work. ****

 


Again thanks in advance for the input, it is very much appreciated.

 

The declaration for the wordDumpObjectVBA function is

void wordDumpObjectVBA(Object o)


The 3rd line in your code snippet is trying to pass a variable of type string to this function when it expects a variable of type object.

The location where you need to concatenate two object attributes into a single string needs to be done inside the wordDumpObjectVBA function. However, this function is loaded with a number of exception checks and also works on whatever columns are present in the current view. So I wonder if it would be easier for you to have a DXL Attribute column in a view that concatenates the two attributes of interest so that you don't need to modify this code?

 

 


Paul Miller,
Melbourne, Australia

 

 

Re: Merging Attributes on Word Export
SystemAdmin - Wed Mar 20 09:44:23 EDT 2013

SystemAdmin - Tue Mar 19 16:36:31 EDT 2013

The declaration for the wordDumpObjectVBA function is

void wordDumpObjectVBA(Object o)


The 3rd line in your code snippet is trying to pass a variable of type string to this function when it expects a variable of type object.

The location where you need to concatenate two object attributes into a single string needs to be done inside the wordDumpObjectVBA function. However, this function is loaded with a number of exception checks and also works on whatever columns are present in the current view. So I wonder if it would be easier for you to have a DXL Attribute column in a view that concatenates the two attributes of interest so that you don't need to modify this code?

 

 


Paul Miller,
Melbourne, Australia

 

 

Your suggestion above has been tried already. The results of that were a lot of extra cleanup work after the export. As the export file needs to be in the book style. I am trying to avoid that, if there is another method to export the concatenated items I am open to try that suggestion. Again thanks for your response, it is appreciated.

Re: Merging Attributes on Word Export
adevicq - Wed Mar 20 09:57:44 EDT 2013

SystemAdmin - Wed Mar 20 09:44:23 EDT 2013
Your suggestion above has been tried already. The results of that were a lot of extra cleanup work after the export. As the export file needs to be in the book style. I am trying to avoid that, if there is another method to export the concatenated items I am open to try that suggestion. Again thanks for your response, it is appreciated.

Hi,
You can use the following function:
 

string applyStyleLockPasteInvokeBuf(OleAutoObj objSelection,
                                 Buffer s,
                                 string styleName)

 


You can build your string and export it to the word doc with a specific style (null if you must use the normal style).
This method is included in the standard word export.
Regards,
Alain

 

Re: Merging Attributes on Word Export
SystemAdmin - Wed Mar 20 11:23:09 EDT 2013

adevicq - Wed Mar 20 09:57:44 EDT 2013

Hi,
You can use the following function:
 

string applyStyleLockPasteInvokeBuf(OleAutoObj objSelection,
                                 Buffer s,
                                 string styleName)

 


You can build your string and export it to the word doc with a specific style (null if you must use the normal style).
This method is included in the standard word export.
Regards,
Alain

 

I gave this a shot but, again I am either misunderstanding or this is not working properly. The code runs but I am only getting the items that don't have "Attribute 1" populated. So If I have ten objects in my module and seven of them have "Attribute 1" populated only three objects are getting exported. I am not sure the function "applyStyleLockPasteInvokeBuf" works the way I want. The fact that it is only exporting some of the objects means to me that the "If" statement is working correctly. It is just the export part of the combined items that is not getting exported.
 

if (o."Attributee 1" "" > "XYZ."){    // **** User Mod Start ****
        Buffer temp = create
        temp = o."Attribute 1" "" " " o."Object Text" ""
        string applyStyleLockPasteInvokeBuf(OleAutoObj objSelection,
                        Buffer temp,
                        string styleName)
        exportStepProgress
}
else { // **** Mod End ****
wordDumpObjectVBA(o)
exportStepProgress
} // **** remove this bracket if this doesn't work. ****

Re: Merging Attributes on Word Export
adevicq - Wed Mar 20 13:10:45 EDT 2013

SystemAdmin - Wed Mar 20 11:23:09 EDT 2013

I gave this a shot but, again I am either misunderstanding or this is not working properly. The code runs but I am only getting the items that don't have "Attribute 1" populated. So If I have ten objects in my module and seven of them have "Attribute 1" populated only three objects are getting exported. I am not sure the function "applyStyleLockPasteInvokeBuf" works the way I want. The fact that it is only exporting some of the objects means to me that the "If" statement is working correctly. It is just the export part of the combined items that is not getting exported.
 

if (o."Attributee 1" "" > "XYZ."){    // **** User Mod Start ****
        Buffer temp = create
        temp = o."Attribute 1" "" " " o."Object Text" ""
        string applyStyleLockPasteInvokeBuf(OleAutoObj objSelection,
                        Buffer temp,
                        string styleName)
        exportStepProgress
}
else { // **** Mod End ****
wordDumpObjectVBA(o)
exportStepProgress
} // **** remove this bracket if this doesn't work. ****

Hi,
The method exports what you tell it to export.
You probably do not enter the piece of code.
Print something before the call to applyStyleLockPasteInvokeBuf. I'm pretty sure that you will discover that your condition is not correct...
Alain

Re: Merging Attributes on Word Export
SystemAdmin - Wed Mar 20 14:28:38 EDT 2013

adevicq - Wed Mar 20 13:10:45 EDT 2013
Hi,
The method exports what you tell it to export.
You probably do not enter the piece of code.
Print something before the call to applyStyleLockPasteInvokeBuf. I'm pretty sure that you will discover that your condition is not correct...
Alain

Again I did as you suggested the exported word file only contains items that don’t have “Attribute 1” filled out. While the print showed me exactly what I wanted. Now I know for sure the problem is with the “applyStyleLockPasteInvokeBuf”. As the print showed the following:

XYZ.XXX Object Text Sentence
XYZ.XXX Object Text Sentence
XYZ.XXX Object Text Sentence
XYZ.XXX Object Text Sentence
XYZ.XXX Object Text Sentence
XYZ.XXX Object Text Sentence

This happened for all the items that have “Attribute 1” filled in. to me this proves my “IF” statement is working properly the method to export the information to the word file is not right.

Re: Merging Attributes on Word Export
SystemAdmin - Wed Mar 20 17:14:50 EDT 2013

SystemAdmin - Wed Mar 20 14:28:38 EDT 2013
Again I did as you suggested the exported word file only contains items that don’t have “Attribute 1” filled out. While the print showed me exactly what I wanted. Now I know for sure the problem is with the “applyStyleLockPasteInvokeBuf”. As the print showed the following:

XYZ.XXX Object Text Sentence
XYZ.XXX Object Text Sentence
XYZ.XXX Object Text Sentence
XYZ.XXX Object Text Sentence
XYZ.XXX Object Text Sentence
XYZ.XXX Object Text Sentence

This happened for all the items that have “Attribute 1” filled in. to me this proves my “IF” statement is working properly the method to export the information to the word file is not right.

The "IF" statement in the code snippet of your most recent post seems to have a typo error - the word "Attribute" has two e's on the end of it - i.e. Attributee. But that should have raised a DXL "unknown Object attribute" error as opposed to the condition never being true.

You said that my earlier suggestion to use an Attribute DXL had been tried but required post export formatting of some sort. Does that you mean you tried to export in Book format and you still had to do soem clean up, or you thought that you had to use Table style to do such an export?

The Book style export works to whatever is the currently visible View in the DOORS module. If you insert a column where a DXL Attribute has performed the concatenation for you, then that DXL Attribute column and all other visible columns in the VIew should export in Book style as required.


Paul Miller,
Melbourne, Australia

Re: Merging Attributes on Word Export
SystemAdmin - Thu Mar 21 08:54:59 EDT 2013

SystemAdmin - Wed Mar 20 17:14:50 EDT 2013
The "IF" statement in the code snippet of your most recent post seems to have a typo error - the word "Attribute" has two e's on the end of it - i.e. Attributee. But that should have raised a DXL "unknown Object attribute" error as opposed to the condition never being true.

You said that my earlier suggestion to use an Attribute DXL had been tried but required post export formatting of some sort. Does that you mean you tried to export in Book format and you still had to do soem clean up, or you thought that you had to use Table style to do such an export?

The Book style export works to whatever is the currently visible View in the DOORS module. If you insert a column where a DXL Attribute has performed the concatenation for you, then that DXL Attribute column and all other visible columns in the VIew should export in Book style as required.


Paul Miller,
Melbourne, Australia

I am aware of the typo, but that is something that exists only on this thread. In the actual code I have there is only one 'e' on the end. Second yes the concatenation of the items in a DXL layout in the module dose work like you previously mentioned, but the output is something like this regardless if you give the column a title/heading:

No Title/Heading:

:
XYZ.XXX Object Text Sentence

With Title/Heading:

Example:
XYZ.XXX Object Text Sentence

So, I would have to do a global search every export to find the colon or the title and colon. This was not a desirable situation especially if using the “paragraph style attribute in the module as when making this combined DXL layout the paragraph style attribute doesn’t get applied for some reason. Which is why I started down this road of modifying the WORD export DXL Code, from all the assistance everyone has provided above this is very close to the proper result but I am stuck on the exporting issue as from the previous few post my if statement is executing properly it is just not exporting the information right.

Again I greatly appreciate all the feedback everyone is providing.