I know this post is pretty old by now, but I thought it might be worth sharing what worked for me, especially in case anyone else needs to do the same thing.
I too wanted to export "N/A" or even hide the field if possible, and wasn't willing to take "no" for an answer. The following field logic helped me accomplish what I wanted in a Word Mail Merge export:
{ IF { IF { MERGEFIELD rationale } = "" "" "rationaleNotEmpty" } = "" "" "Rationale:" } { MERGEFIELD rationale \* MERGEFORMAT }
The second merge field (
{ MERGEFIELD rationale \* MERGEFORMAT }
) is simply telling Jama to export the rationale. Nothing special here. If the rationale field is blank, the output will be blank.
The first merge field is for the title, which I want to disappear if the rationale field is blank, and consists of some logic that stretches the capabilities of Word's mail merge.
- The inner field (
{ MERGEFIELD rationale }
) pulls the rationale field.
- The inner IF statement (
{ IF { x } = "" "" "rationaleNotEmpty" }
) compares "x" against "".
- If "x" is blank, the conditional returns blank.
- If "x" is not blank, the conditional returns "rationaleNotEmpty".
- The outer IF statement simply repeats the logic of the inner IF statement, this time returning "Rationale:" if the conditional is not blank.
- At first glance, the inner IF statement should do everything necessary to remove the desired title ("Rationale:"). But this falls down in one particular instance: if the rationale contains double quotes. This confuses the conditional and returns the wrong values. Adding a second layer of logic forces the correct logic.
Some examples of the output this generates:
If the rationale field is empty:
1.2.3 Requirement Description (ABC-REQ-456)
This requirement shall not have a rationale associated with it.
If the rationale field is empty:
1.2.4 Requirement Description (ABC-REQ-457)
This requirement shall have a rationale associated with it.
Rationale:
Here is the associated rationale.
If the rationale field contains double quotes and the merge field logic doesn't handle it well:
1.2.5 Requirement Description (ABC-REQ-458)
This requirement rationale shall contain double quotes.
double
This rationale contains "double" quotes.
------------------------------
Spencer
------------------------------
Original Message:
Sent: 03-06-2017 19:55
From: Kristina King
Subject: Export N/A if field is empty
Hi Andrew,
Welcome to the community! I hope what you've mentioned about a manual process isn't what I'm about to suggest to you. You can batch update a field in List View. The limitation is that these must be the same item type (but that sounds okay since you specifically mentioned requirements). Once all the items are selected, Actions > Edit will take you through the steps to update the field.
One thing you may consider is setting up your rationale field to be a required field and if it's a pick list field, add N/A to the pick list. (But if it is a text box field, it's not possible to set a default value.)
------------------------------
Kristina King
Jama Software
Original Message:
Sent: 03-06-2017 17:40
From: Andrew Brown
Subject: Export N/A if field is empty
Hello, We would like to export N/A if the rational field of a requirement is empty. Is this possible using the custom word templates? If not is there a batch type method to add this to all the requirements (e.g. if blank change rational to N/A)? The alternative is a very manual process. Help!
Thank you.
------------------------------
Andrew Brown
Galil Medical
Arden Hills MN
------------------------------