removing blank line when using IF in microsoft word using mail merge - doc

I am actually using conga composer with word template to generate word doc fill with data from my database. There is a section where I have to display from a loop a single line that meet a requirement. This also works fine, but when looping, for each line that do not match the requirement words is leaving a blank line. I don't want blank lines to appear :
Here is my IF condition :
A : {{TableStart:TiersPrestataires}}
{ IF "<<variable>>" = "S1" "<<variable1>> <<variable2>>" ""}
{{TableEnd:TiersPrestataires}}
If in my TiersPrestataires variables I have 5 lines , with the 3rd line that respect the condition, this will print :
A :
<blank_line>
<blank_line>
some text represented by variable 1 some text represented by variable2
<blank_line>
<blank_line>
I want to print :
A:
some text represented by variable 1 some text represented by variable2
and that's all.How can I prevent word to replace the unmet condition with a blank line ? Is there something I can specify in my else condition?

It will be the way you position your brackets.
So I am assuming is another conditional, therefore you would do it like:
A:
{ IF (CONDITION 1) "true
"}{ IF (CONDITION 2) "true
"}{ IF "<<variable>>" = "S1" "<<variable1>> <<variable2>>
"}{ IF (CONDITION 4) "true
"}{ IF (CONDITION 5) "true
"}
If you only want to show content when condition is met then you only need to do one set of " " after the condition as false will be blank anyone.
Doing it this way ensures there are no blank lines left from the IF.
Hope this helps.

Related

Keyword 'BuiltIn.Exit For Loop If' expected 1 argument, got 2

I am new learner of RobotFramework, I tried to run this code, but this error shows: Keyword 'BuiltIn.Exit For Loop If' expected 1 argument, got 2. Thank you in advance!
Select the Card
[arguments] ${cardName}
${elements} = Get WebElements css:.card-title
${index}= Set Variable 1
FOR ${element} IN #{elements}
Exit For Loop If '${cardName}' == '${element.text}'
${index}= Evaluate ${index} + 1
END
You have two spaces after ==. Robot uses two or more spaces as argument separators so it sees '${cardName}' == as one argument and '${element.text}' as a second argument.
The solution is to make sure the entire expression doesn't have any sequences of two or more spaces.
Exit For Loop If '${cardName}' == '${element.text}'

Illegal pattern in awk

In awk, we can express patterns in various ways, e. g. as regular expressions enclosed in delimiters /.../ or as a boolean expression where a non-null value (string) or a nonzero value (number) is true. I however have this pattern and I'm wondering what it does:
/test/p
It prints all lines, whatever value p would have and whatever regexp is provided. How is this pattern to be read? In the documentation I didn't find anything about this. I'd expect an error message like when the ending delimiter is missing. (I know it's a common expression for sed.)
The /test/ evaluates to 0 or 1, depending on whether the current record (line) matches the regular expression.
It is string-concatenated with the result of evaluating the variable p (probably an empty string).
So you end up with a condition of either "0" or "1", both of which are true, which means that the default action { print } is executed.
The fact that the p looks like a regex modifier is just a coincidence; the same behaviour can be observed with any of the following, which all produce a non-empty string (p is assumed to be empty):
/test/ p # concatenate 0 or 1 with empty variable
/test/ "" # concatenate 0 or 1 with empty string literal
0 p # "0"
0 "" # "0"

Perl6 split function adding extra elements to array

my #r = split("", "hi");
say #r.elems;
--> output: 4
split is adding two extra elements to the array, one at the beginning and another at the end.
I have to do shift and pop after every split to correct for this.
Is there a better way to split a string?
If you're splitting on the empty string, you will get an empty element at the start and the end of the returned list as there is also an empty string before and after the string.
What you want is .comb without parameters, written out completely functionally:
"hi".comb.elems.say; # 2
See https://docs.raku.org/routine/comb#(Str)_routine_comb for more info.
The reason for this is when you use an empty Str “” for the delimiter it is the same as if you had used the regex /<|wb>/ which matches next to characters. So it also matches before the first character, and after the last character. Perl 5 removes these “extra” strings for you in this case (and in this case only), which is likely where the confusion lays.
What Perl 6 does instead is allow you to explicitly :skip-empty values
'hi'.split('') :skip-empty
'hi'.split('', :skip-empty)
split("", "hi") :skip-empty
split("", "hi", :skip-empty)
Or to specify what you actually want
'hi'.comb( /./ )
'hi'.comb( 1 )
'hi'.comb
comb( /./, 'hi' )
comb( 1, 'hi' )

Extra blank space between words

Please help me with 2 questions on how to do the GREL expression for:
If there are double spaces between 2 words in a column, how can I eliminate 1 space Example: Robert--Smith to Robert-Smith The minus character equals a blank for illustration
How can I look for an exact word in a text filter.
Thanks!
1°) try transform---> value.replace(" "," ")
Or, simply common transforms ----> collapse consecutive white spaces
2°) Column ---> text filters and enter you word
Or, do column---> Facet---> Customs facet and type : value.contains(" you_word ")
or value.contains(/(yourexactword)/)
This will return a True or False facet
H.
#hpiedcoq is the right answer if you need to have them in GREL. if not you can just use the point and click interface:
for the first question: Select your column and select Edit cells > Common transforms > Collapse consecutive white space
for the second question: select your column > text filter > enter the work you are looking for. You can select case sensitive if you want to take into account upper and lower case in your search.
1.1 transform -- > value.replace(" "," ")
Deletes all double whitespace.
1.2 transform -- > value.trim()
Deletes all double whitespace and deletes whitespaces before and after the string.
1.3 transform -- > value.replace(/\b \b/," ")
Replace with regular expression, deletes only double whitespace between two words.
Text filter > turn on regular expression and use \b.
Text filter with regular expression: \bWord\b = exact word, before and after the word may or may not be a only whitespace.

Vi: how to automatically insert spaces

I'm trying to write a nice feature for crazy people like me who like there lines to be perfectly aligned.
I often write some file in which the format is "key = value".
Since the key may contain an indeterminate number of character, one have to manually align the "=" symbols which is not cool.
Is there a way to tell vi "when someone type the equal character, then insert as spaces as necessary to go to the column 25, then write an the equal symbol"?
The second step will be to define a shortcut to apply this format to an entire file.
Any help would be appreciated.
Ben.
Map the behavior of = in Insert Mode.
Next code will add spaces until column 24 from current cursor position and will add an equal sign after it. If there were characters after cursor position (suppose in a middle of a word), those characters will be moved after column 25. Add it to your vimrc file and try.
"" If length of the line is more or equal to 24, add an equal sign at the end.
"" Otherwise insert spaces from current position of cursor until column 24
"" and an equal sign, moving characters after it.
function My_align()
let line_len = strlen( getline('.') )
if line_len >= 24
s/$/=/
return
endif
let col_pos = col('.')
exe 's/\%#\(.\|$\)/\=submatch(1) . printf( "%' . (24 - col_pos) . 's%s", " ", "=" )/'
endfunction
inoremap = <Esc>:call My_align()<CR>A
For second step, use the multiple repeats command, check for an equal sign and insert spaces until column 25 just before it. Won't work if equal sign is after column 25 before executing it, but you get the idea.
:g/=/exe 's/=/\=printf( "%' . ( 24 - stridx( getline('.'), "=" ) ) . 's", " " ) . submatch(0)/'