Reputation: 1362
I have a COA
where I need to get the second line from the description field using split. The problem is I only want to wrap it if the line has something on it. I tried using required = 1
but it only works if there is no line at all (e.g. I have an empty 2nd line with something on 3rd line).
11 = TEXT
11 {
stdWrap.field = rowDescription
stdWrap.split {
token.char = 10
returnKey = 1
}
required = 1
wrap = <h6>|</h6>
}
Upvotes: 1
Views: 660
Reputation: 2684
Try to trim the white space away before checking the result with required. To do so you need to switch to listNum instead of split due to the order of functions within the stdWrap tool kit:
10 = COA
10 {
stdWrap.wrap = <h6>|</h6>
stdWrap.required=1
10 = TEXT
10 {
field = rowDescription
listNum = 1
listNum.splitChar = 10
trim = 1
}
}
Upvotes: 1
Reputation: 1
11 = COA
11 {
10 = TEXT
10 {
field = rowDescription
split.token.char = 10
split.returnKey = 1
}
stdWrap.required=1
stdWrap.wrap = <h6>|</h6>
}
This would be my attempt to solve this. Advantage would be that it would be extensible and other lines or factors could be added to the list.
The COA would only be printed if any item in its list would return anything other than "", null or 0
Upvotes: 0