Categories > TinyButStrong general >

Pb Using subblock into subblock

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Ralph7
Date: 2014-11-14
Time: 20:10

Pb Using subblock into subblock

Hi everybody!

I have a problem with merging  subblock in subblock. I've tried to use it recursively without success.

I get this error:
"Fatal error: Uncaught exception 'tinyDocException' with message 'key 'detail_cpte' is not found in record #1 of block [detail_sub1]. This key can become optional if you designate it with parenthesis in the main block, i.e.: sub1=(detail_cpte)' in /u01/yobapp/web/ws41/trunk/www/lib/edition/tinyDoc-1.0.3/lib/tinyDoc.class.php:1578 Stack trace: #0 /u01/yobapp/web/ws41/trunk/www/lib/edition/tinyDoc-1.0.3/lib/tbs_class.php(2473): tinyDoc->meth_Misc_Alert('for merging the...', 'key 'meth_Merge_SectionNormal(Object(stdClass), Object(clsTbsDataSource)) #2 /u01/yobapp/web/ws41/trunk/www/lib/edition/tinyDoc-1.0.3/lib/tbs_class.php(2001): clsTinyButStrong->meth_Merge_BlockSections('"



In my template(.odt) I'm initializing automatic subblock in subblock like this:

[detail.cod_class;block=table:table-row;sub1=list_cpte]
[detail_sub1.cod_cpte;block=table:table-row;sub1=detail_cpte]  (- level 1 is OK)
[detail_sub1_sub1.lib_ecrit;block=table:table-row]  (- level 2 is not working)


And I have an array structure like this:

detail:

Array
(
    [0] => Array
        (
            [list_cpte] => Array
                (
                    [0] => Array
                        (
                            [cod_cpte] => 401000003
                            [lib_cpte] => toto
                            [cod_cpte_pere] => 401
                            [typ_cpte] => E
                            [detail_cpte] => Array
                                (
                                    [0] => Array
                                        (
                                            [num_lot] => 6
                                            [cod_jrnl] => 2
                                            [lib_ecrit] => 2 20141029 3 FONGANG
                                            [dat_ecrit] => 29/10/2014
                                            [debit] =>
                                            [credit] => 179.4
                                            [solde] => -179,40
                                            [num_lettrag] =>
                                        )

                                    [1] => Array
                                        (
                                            [num_lot] => 7
                                            [cod_jrnl] => 2
                                            [lib_ecrit] => 2 20141029 3 toto
                                            [dat_ecrit] => 29/10/2014
                                            [debit] =>
                                            [credit] => 179.4
                                            [solde] => -358,80
                                            [num_lettrag] =>
                                        )


Any help would be greatly appreciated ! Thanks by advance.
By: Skrol29
Date: 2014-11-17
Time: 02:33

Re: Pb Using subblock into subblock

Bonjour Ralph7,

Your template snippet looks ok.
And you data snippet look ok too regarding to the template.
And TBS does supports nested automatic sub-blocks.

So the error seems to tell that at least one record is not as you expect.
Try to replace parameter "sub1=detail_cpte" with "sub1=(detail_cpte)" and see if all level-2 record are missing or if only some are missing.

By: Ralph7
Date: 2014-11-17
Time: 13:45

Re: Pb Using subblock into subblock

Bonjour Skrol29,

Thanks for the return.

I've tried that solution as stated in the error message, but getting others error like "... message 'key '(detail_cpte)' is not found in record #1 of block [detail_sub1]. This key can become optional if you designate it with parenthesis in the main block, i.e.: sub1=((detail_cpte))'...."

However, The problem is Ok now !
It may has been some issue dealing with my odt template (I am still not sure of what precisely was missing...), but after having erased and retyped the variables,  I got my edition !

It was the first time I used nested automatic sub-blocks with TBS. It's just cool !

Thanks
By: Skrol29
Date: 2014-11-17
Time: 15:16

Re: Pb Using subblock into subblock

Enjoy
:-)