By: Ivor
Date: 2016-03-09
Time: 21:52
|
Struggling with conditional blocksHi, I am having some trouble with getting conditions blocks to work correctly. I am new to TBS but have created some nice shortcuts for some repetitive c++ coding of messages.
My data source is from sqlite. I use the @ symbol since '[' is used in c++ Can you please assist me in how to do this. I have read the documentation but still struggle. TBS is too strong for me. In my template I have the following bought code (it does not work)
|
||
By: Ivor
Date: 2016-03-10
Time: 17:24
|
Re: Struggling with conditional blocksScrol29, I sent an email to your gmail with much more info.
Regards Ivor |
||
By: Ivor
Date: 2016-03-11
Time: 21:19
|
Re: Struggling with conditional blocksPlease... anyone with some help on using conditional blocks using absolute syntax?
|
||
By: Skrol29
Date: 2016-03-11
Time: 21:54
|
Re: Struggling with conditional blocksHi Ivor,
TBS does not supports the same characters for beginning and ending tags. I have tested, it doesn't work, but it is also logical: how can you solve a tag such as
Since TBS does not supports this it is a bug that there is no alert. This will be fixed in next version. |
||
By: Ivor
Date: 2016-03-11
Time: 22:41
|
Re: Struggling with conditional blocksScroll29, thanks a million for replying. I was meaning to double check about the same start and end tag, but somehow I never got round to it.
So having changed to use the standard open and close chars, my conditional blocks look like this now as below, but they print all the text in between, i.e. as if always true Is my syntax for using absolute blocks syntax wrong? Does the "when" only work with onshow?
wit the result
|
||
By: Skrol29
Date: 2016-03-11
Time: 22:50
|
Re: Struggling with conditional blocksHi Ivor,
Parameter "p1" should be placed on the first section only. According the the documentation : « Each section of the block to be merged that contains a parameter p1 will be computed as a separate block for which the dynamic query is re-executed. The sections of the block that have no parameter p1 are combined with the previous section with a parameter p1. » http://www.tinybutstrong.com/manual.php#html_block_subblock So you should try:
|
||
By: Ivor
Date: 2016-03-11
Time: 23:14
|
Re: Struggling with conditional blocksThanks, ok now I understand that sentence in the manual ;>)
I have implemented your advice and it is working fantastic! See below. You will notice the problem with the [ for the fields that contain a '['. I think I saw something on that in the manual... How would you suggest that I recurse the struct. in the example I am using, the sCrestPoint is an array structs.
|
||
By: Skrol29
Date: 2016-03-11
Time: 23:38
|
Re: Struggling with conditional blocks> You will notice the problem with the [ for the fields that contain a '['. I think I saw something on that in the manual...
This is a protection against field injection. You simply have to use parameter "protect=no".
|
||
By: Ivor
Date: 2016-03-11
Time: 23:40
|
Re: Struggling with conditional blocksThanks, you are amazing, there seems to be nothing that TBS cannot do.
|
||
By: Skrol29
Date: 2016-03-11
Time: 23:49
|
Re: Struggling with conditional blocks:-)
|
||
By: Ivor
Date: 2016-03-12
Time: 00:11
|
Re: Struggling with conditional blocksSo this is now what I end up with. It looks really good.
The only thing I still need to sort out is to detect that the field is an array (probably with some regular expression) and then to insert some loop code. Unfortunately regular expressions are not my strong point. But first, i must go get some sleep ;>)
|
||
By: Ivor
Date: 2016-03-12
Time: 10:38
|
Re: Struggling with conditional blocksScroll, is it possible to globally enable the [protect = no]? Because the '[' is used in c++, I need to put it in almost every block.
Regards Ivor |
||
By: Ivor
Date: 2016-04-06
Time: 08:50
|
Re: Struggling with conditional blocksSkrol, I am struggling with a piece of template that I am sure is right, but it does not work. I have stared at it for hours and tried all sorts of "tricks" to get it to work. Obviously doing something stupid again.
I would much appreciate it if you could have a quick look at it. Merci. The problem I have is that the "Construct" message portion is not executed(inserted) even though the messages does exist with that condition. The msg_grp_names25 field contains two groupings; LDU Messages DDU Messages In each of these groupings, messages are contained with a name (msg_name) format as below: Cdu2Ldu_xxxx Ldu2Cdu_xxxx Cdu2Ddu_xxxx Ddu2Cdu_xxxx where xxxx is a specific message's name.
|