Hi Michael, I recently needed the same thing (checking the value of a checkbox inside cheetah code). After some tinkering, the way to do it is: <param name="skip" type="boolean" label="skip something"> <command> #if $skip.value == True: --skip-- #else --don't skip-- #end if </command> Note the '$skip.value' (and not just '$skip') which is a boolean (not a string). No need for 'truevalue' and 'falsevalue'. Regards, -gordon Kanwei Li wrote, On 07/12/2010 03:20 PM:
Hi Michael,
I think boolean parameters require you to set truevalue and falsevalue if you're going to use them further in the xml file, so the way you're doing it now is correct.
-Kanwei
On Mon, Jul 12, 2010 at 5:23 AM, Michael Siebauer <michael_siebauer@eva.mpg.de> wrote:
That doesnt seem to work, regardless wheter the chechbox is checked or not, the if condition is always evaluated as true. :-/
As a workaround I use now:
<param name="skip" type="boolean" label="skip something" truevalue="--skipsomething" falsevalue="">
But it would be way nicer if could manage to use if conditions.
Am 09.07.2010 18:22, schrieb Jesse Erdmann:
Try this:
<command interpreter="python">tool.py #if $skip == True -skipsomething #endif $output </command>
On Fri, Jul 9, 2010 at 10:46 AM, Michael Siebauer <michael_siebauer@eva.mpg.de> wrote:
Hi,
I want to ask if it is possible to evalute the value of some tool checkboxes within this cheetah templates. I want to do something like this.
A certain tool has the ability to skip some test (e.g. --skipsomething). So I added a checkbox option for the user and depending of his selection the commandline should be:
tool.py $input $output or tool.py $input --skipsomething $output
<tool name="tool" id="tool"> <command interpreter="python"> tool.py $input #if $skip.value == "true" #--skipsomething #endif '$output' </command> <inputs> <param name="input" type="text" label="Full path to source file"/> <param name="skip" type="boolean" label="skip something">
</input> ...
Or is there an easier way to achieve this without cheetah?
Thx for help and haveaniceweekend ;-)