Duplicate Variable Definition Inside Choose Block

239 Views Asked by At

I think the code below should work in a Word BI Publisher template, but it's not. When I use the BI Publisher Template Viewer app to test, it is showing Duplicate variable 'branch' definition. If only the matching <?when: ...?> block should be executed, how is the variable defined more than once?

I have experience in other programming languages, but XML/XSL/BIP, etc. is new to me. Can anyone shed some light on the below code?

Thanks!

<?variable:payco; xdoxslt:trim(Remit_to_Name_ID445)?>

<?choose:?>
<?when: $payco=”Company1”?>
<?variable@begin:branch;'CO1'?>
<?end when?>
<?when: $payco=’Company2’?>
<?variable@begin:branch;'CO2'?>
<?end when?>
<?when: $payco=’Company3’?>
<?variable@begin:branch;'CO3'?>
<?end when?>
<?end choose?>

1

There are 1 best solutions below

0
EdHayes3 On

I can think of a few options to solve your logo problem.

  1. Update the data definition SQL to do a decode/concatenation or something to get your logo filename or variable in the SQL as its own field that's extracted into the XML. That way you can use this when determining the image path:

    url:{concat('/logos/',branch,'-logo.jpg')}

  2. Use if statements or choose/when in your RTF to select an entire image section. This would mean you need to update the RTF every time you add a branch/brand, but it's doable.