Categories > TinyButStrong general >

Text in Headergrp from other MySQL table with p1=%1%

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: RobN
Date: 2009-06-20
Time: 09:01

Text in Headergrp from other MySQL table with p1=%1%

Hello,

I want to have the text of a group in the header of a table. Each time the group changes, the headertext should change also. Now I have the groupnumber correctly displayed in the table, but I need the text belonging to that groupnumber.

I tried it with
[afwerking.omschrijving_nl;p1=[product.afwerking];block=tr;headergrp=[afwerking]]
using the following MySQL statements in TBS:
$TBS->MergeBlock("product",$db_id,"SELECT * FROM product $WHERE_id ORDER BY afwerking, volgnummer, productnummer ASC");
$TBS->MergeBlock("afwerking",$db_id,"SELECT * FROM afwerking WHERE (afwerking.id='%p1%') ");

Probably I missed something and appreciate your help very much. I use TBS V 3.4.0. with PHP 5
Thanks,
Rob
By: RwD
Date: 2009-06-20
Time: 11:28

Re: Text in Headergrp from other MySQL table with p1=%1%

I think you need to get rid of the square brackets at the headergroups fieldname. eg, headergrp=afwerking. But also, the headergrp needs to be a column name, not the name of the tbs block.

[afwerking.omschrijving_nl;p1=[product.afwerking];block=tr;headergrp=omschrijving_nl]
By: TomH
Date: 2009-06-20
Time: 14:59

Re: Text in Headergrp from other MySQL table with p1=%1%

Not meaning to hijack here...
but you could also consider using an MySQL join query to get one result set with all of the data contained in it.

Then using the appropriate ORDER BY clause you could eliminate the TBS p1= sub blocks (which can be time/resource hungry in some situations).

If you need help with the join just ask here or Google 'MySQL join tutorial'

In your case, you would add ORDER BY the afwerking.id as the major sort then by the other fields as needed.

Cheers,
By: RobN
Date: 2009-06-21
Time: 16:09

Re: Text in Headergrp from other MySQL table with p1=%1%

RwD and TomH,

Thanks for your suggestions. I now use the Join statement and it seems to work. Somewhere it misses some results but that is probably due to an error in the database.

Regards,
Rob