Categories > [old] TbsOoo & TinyDoc >

sxw document to display 2 embedded arrays (NOT sub-selects!)

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Peter
Date: 2006-01-11
Time: 22:24

sxw document to display 2 embedded arrays (NOT sub-selects!)

Hello Skrol29, Hello Forum Members,

I should make an OpenOffice sxw report (explained below). Please let me explain my problem.

I can not use the "Dynamic queries / sub-blocks" example in the help, because I have my database on a different server than the TBSOOo report.

I pass all data (2 arrays) to the reporting PHP code using a HTML FORM element.

The reporting PHP code should arrange the data something like this:

FIRST PAGE

ARRAY1['data_a'][1]
ARRAY1['data_a'][2]

     ARRAY2['data_a'][1][1]     ARRAY2['data_a'][1][2]     ARRAY2['data_a'][1][3]
     ARRAY2['data_a'][2][1]     ARRAY2['data_a'][2][2]     ARRAY2['data_a'][2][3]
...(ARRAY2['data_a'] : array size is 'n')...
     ARRAY2['data_a'][n][1]     ARRAY2['data_a'][n][2]     ARRAY2['data_a'][n][3]

ARRAY1['data_a'][3]

PAGE BREAK
SECOND PAGE
ARRAY1['data_b'][1]
ARRAY1['data_b'][2]

     ARRAY2['data_b'][1][1]     ARRAY2['data_b'][1][2]     ARRAY2['data_b'][1][3]
     ARRAY2['data_b'][2][1]     ARRAY2['data_b'][2][2]     ARRAY2['data_b'][2][3]
...(ARRAY2['data_b'] : array size is 'p')
     ARRAY2['data_b'][p][1]     ARRAY2['data_b'][p][2]     ARRAY2['data_b'][p][3]

ARRAY1['data_b'][3] ---> The size of ARRAY1 is always constant.

PAGE BREAK

etc.

What could you propose?

Thank you any help in advance!

Peter
By: Skrol29
Date: 2006-01-12
Time: 12:43

Re: sxw document to display 2 embedded arrays (NOT sub-selects!)

Hello Peter,

I don't understand well you design, but you can use sub-blocks/dynamic query with an array. Use the keyword 'array' for that.

Example:
$TBS->Mergeblock('blk1','array','my_glob_var[data_a][%p1%]');
By: Tom
Date: 2006-01-12
Time: 16:21

Re: sxw document to display 2 embedded arrays (NOT sub-selects!)

Peter

Also -- the normal mysql in php will allow you connect to remote server by using
// we connect to example.com and port 3307
$link = mysql_connect('example.com:3307', 'mysql_user', 'mysql_password');
You can also change the 'default host' for mysql in PHP
with the "mysql.default_host" config var
Sometimes the port should be 3306

HTH,
By: Peter
Date: 2006-01-12
Time: 18:47

Re: sxw document to display 2 embedded arrays (NOT sub-selects!)

Hello Tom,

My current hosting provider doesn't support remote mysql access, but thanks anyway.
By: Peter
Date: 2006-01-12
Time: 18:55

Re: sxw document to display 2 embedded arrays (NOT sub-selects!)

Hello Skrol29,

ARRAY1 has N elements, ARRAY2 has M>N elements.

I would like to put N pages on the report that contain the rows of ARRAY1,
and every page should contain rows from ARRAY2 that match the current
values of ARRAY1.

Thanks for the tip, I will try it out tonight.

Peter
By: Peter
Date: 2006-01-12
Time: 23:46

Re: sxw document to display 2 embedded arrays (NOT sub-selects!)

Thank you Skrol29, it works!!!