Categories > TinyButStrong general >

Dynamic columns with conditions

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Edwin Stas
Date: 2016-03-04
Time: 09:30

Dynamic columns with conditions

Trying to add conditions to the dyncol1 example.

<table border="1" cellpadding="3" cellspacing="0" style="margin-left:auto; margin-right:auto;">
<tr>
    <td width="60" align="center" class="cell-0">X</td>
     <td align="center" class="cell-front">[c.key;block=td;parallel=tbs:table] </td>
</tr>
<tr>
    <td align="center" class="cell-front">[r.$;block=tr]</td>
    <td align="center" class="cell-1">[r.[c.val];if[val]=10;then 'X';else 'Y'] </td>
</tr>

But it’s not working. How are conditions handled with dynamic columns?
By: Skrol29
Date: 2016-03-05
Time: 00:05

Re: Dynamic columns with conditions

simply replace :
[r.[c.val];if [val]=10;then 'X';else 'Y']
with :
[r.[c.val;if [val]=10;then 'X';else 'Y']]
it should work
By: Edwin Stas
Date: 2016-03-07
Time: 08:12

Re: Dynamic columns with conditions

Thanks Skrol, that’s working great in the examples.

In another post (http://www.tinybutstrong.com/forum.php?thr=3626) I’m using dynamic columns in a slight different way. And when trying the condition, nothing happens.


<table class="ep_kader">
<tbody>
<tr>
    <td class="kol1">[onload.epartnr]</td>
    <td class="kols">[da.artnr;block=td;parallel=tbs:table]</td>
</tr>
<tr>
    <td class="kol1 [c.ep_type;magnet=tr]">[onload.eptype]</td>
    <td class="kols">[da.ep_type;if [val]='Y';then 'Yes']</td>
</tr>
………