Categories > TinyButStrong general >

Serial display and record number

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Alex
Date: 2013-03-28
Time: 11:59

Serial display and record number

Hi.
I want to make table like
|name1|name2|some text
|name3|name4|
...
|name9|name10|

<tr>[default;block=tr;serial]
<td>[default_1.name;block=td]</td>
<td>[default_2.name;block=td]</td>
<td rowspan="5">[onshow;block=td;when [default.#]=1] some text </td>
</tr>

Is it possible to get number of current record from "default" array?
Or how can I deny repeat last <td> in serial display?
By: Sarah
Date: 2013-03-28
Time: 16:39

Re: Serial display and record number

[default.#] should return the record number.

What does the last td contain when the template has been merged? What if you change onshow to onshowx so we can see the when condition as it is checked (by preventing the onshow merge)?
By: Alex
Date: 2013-03-28
Time: 17:25

Re: Serial display and record number

[default.#] don't works.
If i try to print it like:
<tr>[default;block=tr;serial]
<td>[default_1.name;block=td]</td>
<td>[default_2.name;block=td]</td>
<td>[default.#]</td>
</tr>

In result i see "[default.#]" and not record number.
By: Sarah
Date: 2013-03-28
Time: 17:59

Re: Serial display and record number

I see the problem now. 'serial' appears to interfere with $ and # for showing current record number. Perhaps you could include a count in your data structure (if you control it), or you could try adding an 'ondata=fct_name' function (details in manual under TBS Blocks section) which adds a flag to the last record. Or you can use normal blocks and subblocks (without 'serial') - though this may be more work or not a good solution depending on how many columns you have and whether the number is dynamic.
By: Anonymous
Date: 2013-03-28
Time: 21:01

Re: Serial display and record number

Ok, thanks for your reply.
I found solution for my case: (count of default array = 10)
<tr>[default;block=tr;serial]
<td>[default_1.name;block=td]</td>
<td>[default_2.name;block=td+td]</td>
<td rowspan="5">[onshow;block=td;when [default_2.#]=2]some text</td>
</tr>
In result i will have table:
|name1|name2|some text
|name3|name4|
|name5|name6|
|name7|name8|
|name9|name10|