Duplicate Variable Definition Inside Choose Block - bi-publisher

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?>

I can think of a few options to solve your logo problem.
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')}
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.

Related

Using signature file in script

I like using .fsi signature files to control visibility. However, if I have both Foo.fsi and Foo.fs files in my solution, and #load "Foo.fs" in a script, it doesn't seem like the corresponding signature file gets used. If I do:
#load "Foo.fsi"
#load "Foo.fs"
... then the desired visibility control happens. Is this the recommended way to achieve this, or is there a better way to do it? In a perfect world, one would like to see the signature file automatically loaded, too.
Not a final answer, but a better way.
From reading Expert F# 4.0 one can do
#load "Foo.fsi" "Foo.fs" "Foo.fsx"
All three loads are on one line.
TL;DR
The link to the book is via WolrdCat just put in a zip code and it will show you locations near there where the book can be found.

How to create and load a configuration file in dxl

I have a script which saves some files at a given location. It works fine but when I send this code to someone else, he has to change the paths in the code. It's not comfortable for someone who does not know what is in that code and for me to explain every time where and how the code should be changed.
I want to get this path in a variable which will be taken from the configuration file. So it will be easier for everyone to change just this config file and nothing in my code. But I have never done this before and could not find any information on how I can do this in the internet.
PS: I do not have any code and I ask about an ultimate solution but it is really difficult to find something good in the internet about dxl, especially since I'm new with that. Maybe someone of you already does that or has an idea how it could be done?
DXL has a perm to read the complete context of a file into a variable: string readFile (string) (or Buffer readFile (string))
you can split the output by \n and then use regular expressions to find all lines that match the pattern
^\s*([^;#].*)\s*=\s*(.*)\s*$
(i.e. key = value - where comment lines start with ; or #)
But in DOORS I prefer using DOORS modules as configuration modules. Object Heading can be the key, Object Text can be the value.
Hardcode the full name of the configuration module into your DXL file and the user can modify the behaviour of the application.
The advantage over a file is that you need not make assumptions on where the config file is to be stored on the file system.
It really depends on your situation. You are going to need to be a little more specific about what you mean by "they need to change the paths in the code". What are these paths to? Are they DOORS module paths, are they paths to local/network files, or are the something else entirely?
Like user3329561 said, you COULD use a DOORS module as a configuration file. I wouldn't recommend it though, simply because that is not what DOORS modules were designed for. DOORS is fully capable of reading system files in one line at a time as well as all at once, but I can't recommend that option either until I know what types of paths you want to load and why.
I suspect that there is a better solution for your problem that will present itself once more information is provided.
I had the same problem, I needed to specify the path of my configuration file used in my dxl script.
I solved this issue passing the directory path as a parameter to DOORS.exe as follow:
"...\DOORS\9.3\bin\doors.exe" -dxl "string myVar = \"Hello Word\"
then in my dxl script, the variable myVar is a global variable.

Is there any editor or popular editor extension that automatically remove quotes/brackets?

There are too many text editors, which have the function, that if I just select a piece of the code and press the quote/bracket key, the selected code becomes wrapped into the type of the quotes/brackets I pressed. But do you know any or are you using any, which has also the function, that if I select the piece of the code wrapped into the quotes/brackets and press the same quote/bracket key or some key combination, that piece of code becomes unwrapped?
Also if you know any editor or popular editor extension that automatically remove all quotes/brackets from the code, please write it too. Everything would be helpful.
We are doing some research and this question is still unanswered. Please help us if you know anything about.
I create a simple Zeus (Windows) Lua script that does this for the quote case (i.e. the macro wraps any marked area in quotes).
In a similar fashion another script could be written for the brackets case.
Also as this simple script shows, this should be possible in any scriptable editor.
The script can be found here: http://www.zeusedit.com/zforum/viewtopic.php?t=7148
SynWrite editor (Windows) can do scripting for u. You can write Python plugin in 10min, and assign it a hotkey, so selection (or all text) will dequote, or what ever.
Finally, I've made it by writing my own extension to my favourite editor.

Filemaker: exporting a PLIST (for iOS)

I have a database which I want to export as an iOS compatible PLIST.
The work around I have come up with is to create a calculated field which adds the tagged padding and header and creates a report using these fields. I then export the preview of the report as a PDF, open the PDF in Acrobat Reader, select all text, copy and paste into XCode which recognises the PLIST format and all works as expected.
Is there a better way of doing this? (This seems a really convoluted way of doing things, high chance of error, etc.) The Export as XML option looks promising but I can't seem to join the dots.
Two ways that I can think of to do what you're trying to do. The most elegant way is probably the XML with XSLT export which you suggest. If you don't already know XSLT, though, you might try the following -- it sounds like with the calculated XML line you've already created, like this would be a simple change to your database:
Create a single new global field, say outputXML
Create a script, say plistCreator
In the plistCreator script:
Set outputXML to ""
Go to the first record you want to export
Loop through every record putting your calculated XML line into outputXML (set field outputXML to outputXML & ¶ & calculatedXMLLine)
Go to next record, exit after last
Export Field Contents (note that this is a different command than Export) for outputXML
The cleanest solution is to use the export XML with an XSLT for transforming the output. You'll need to know a little XSLT to do this, or at least be able to customize the examples from FileMaker.

Does Texniccenter or any other tex editor auto-complete references in Latex?

I want to use a latex editor that has auto completion feature for existing references in a latex file. Do you know any good ones? I am trying to find this feature in texniccenter, but I guess it doesn't exist or I could't find it yet.
Update:
Ok, I found how to enable auto completion in Texniccenter. I needed first create a project. Then open the file in this project (or copy its text). Now Ctrl-Space inside a \ref{} tag completes the reference automatically.
Texlipse does this, also with Ctrl+Space.
Inlage includes such a function, too. New commands and new environments will also appear in the auto completion list. If you use extern BibTex files the \cite{} command will open a list with your articles and books from you .bib file.
Ok, I found it. I needed first create a project. Then open the file in this project (or copy its text). Now Ctrl-Space inside a \ref{} tag completes the reference automatically.
Kile has reference completion. If you type Ctrl+Space inside of a \ref{}, you get a list of all the references (that existed last time you compiled, of course).
LEd presents a click list of them when in a \ref{}
The RefTeX mode for Emacs will do what you're asking for: the shortcut C-c ) activates the "insert a \ref" mode (of course, you can customize which type of reference: fancyref, hyperref, etc) and pressing TAB will allow you to start typing and autocomplete by tabbing again after typing some characters.
It also figures out (or asks if it can't) what sort of ref you're inserting and shows a list of all the defined \labels in your document, selectable with the arrow keys or C-n / C-p.
Now we just need a Vi user to come along and tell us how to do it there...
Now texmaker does, not need any special key.

Resources