Categories > TinyButStrong general >

block : first and last item

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: yazul
Date: 2013-01-24
Time: 16:56

block : first and last item

i'm using TBS to generate SQL (create table...)

fields of the table are in a TBS block, it's OK.

create table mytable (

name1 integer,
name2 varchar(20),
nameLast varchar(20)
);

each field instruction ends with a "," except the last !
is there any condition in TBS like "first_item" and "last_item" ?

i add 2 logicals called "tbs_first" and "tbs_last" which i can test but this sucks when i use a block condition :

[field;block=begin;when...]
...
[field;block=end]

when my first and last fields haven't the condition, i can't test my logicals.

any idea ?
By: Skrol29
Date: 2013-01-27
Time: 00:23

Re: block : first and last item

Hi,

They a several ways to do that:

1)
Move the coma (",") to the begining of each fields. So it would be like this :
CREATE TABLE mytable (
  name1 integer
, name2 varchar(20)
, nameLast varchar(20)
);
Then, you can manage the coma as a TBS field : [field.#;if [val]=1;then '';else ',']

2)
Use parameter "splittergrp"  to define a section that will be displayed only between records. Use this section to display only the coma.
By: yazul
Date: 2013-01-27
Time: 00:31

Re: block : first and last item

Nice ideas : i'll try these.
Thanks