Forums

XLS export and DB relations

admin_wiky 27 Aug, 2015
Hi Bob,

i am trying to export records from 2 DB tables thru relations, but it doesnt export data when I have enabled relations on db read.

why relations?
Main table has some columns that refer (id) to second table where are detailed informations (like name) to use insted of ID. I tried different types of relations but same result, data are shown in debugger, but nothing exports:
Array
(
    [7] => Array
        (
            [DB Read] => Array
                (
                    [Queries] => Array
                        (
                            [0] => SELECT `expfak`.`cf_id` AS `expfak.cf_id`, `expfak`.`cf_uid` AS `expfak.cf_uid`, `expfak`.`cf_created` AS `expfak.cf_created`, `expfak`.`cf_modified` AS `expfak.cf_modified`, `expfak`.`cf_created_by` AS `expfak.cf_created_by`, `expfak`.`cf_modified_by` AS `expfak.cf_modified_by`, `expfak`.`cf_ipaddress` AS `expfak.cf_ipaddress`, `expfak`.`cf_user_id` AS `expfak.cf_user_id`, `expfak`.`filialka_id` AS `expfak.filialka_id`, `expfak`.`datum` AS `expfak.datum`, `expfak`.`rok` AS `expfak.rok`, `expfak`.`cislo_faktury` AS `expfak.cislo_faktury`, `expfak`.`dodavatel` AS `expfak.dodavatel`, `expfak`.`popis` AS `expfak.popis`, `expfak`.`sazba` AS `expfak.sazba`, `expfak`.`cena_bDPH` AS `expfak.cena_bDPH`, `expfak`.`dopravne_bDPH` AS `expfak.dopravne_bDPH`, `expfak`.`poznamka` AS `expfak.poznamka`, `expfak`.`autorizovano` AS `expfak.autorizovano`, `expdod`.`cf_id` AS `expdod.cf_id`, `expdod`.`cf_uid` AS `expdod.cf_uid`, `expdod`.`cf_created` AS `expdod.cf_created`, `expdod`.`cf_modified` AS `expdod.cf_modified`, `expdod`.`cf_created_by` AS `expdod.cf_created_by`, `expdod`.`cf_modified_by` AS `expdod.cf_modified_by`, `expdod`.`cf_ipaddress` AS `expdod.cf_ipaddress`, `expdod`.`cf_user_id` AS `expdod.cf_user_id`, `expdod`.`dodavatel` AS `expdod.dodavatel`, `expdod`.`ico` AS `expdod.ico`, `expdod`.`dic` AS `expdod.dic` FROM `yjw8h_cf_data_filialka_faktury` AS `expfak` LEFT JOIN `yjw8h_cf_data_dodavatele` AS `expdod` ON `expdod`.`cf_id`=`expfak`.`dodavatel` GROUP BY `expfak`.`cf_id`
                        )

                )

        )

    [8] => Array
        (
            [XLS Export] => No data could be loaded or found, please check your action settings.
        )

)

It exports only when I disable relations.

thanks, jozka
GreyHead 27 Aug, 2015
Hi jozka,

The query looks OK but hard to be sure without the tables. I suggest that you copy and paste it into PHPMyAdmin to debug.

Bob
admin_wiky 27 Aug, 2015
Yes, I did try query to phpmyadmin and result was returned.
I need to get name to the field autorizovano insted of id.
GreyHead 27 Aug, 2015
Hi jozka,

So the query works in PHPMyAdmin but not in the form - that is odd.

Is the data read from the table and visible in the debugger output?

Bob
admin_wiky 27 Aug, 2015
Yes, output is visible in debugger
Array
(
    [cont] => lists
    [ccname] => evidencefaktur
    [act] => export
    [fltr] => Array
        (
            [faktury] => Array
                (
                    [dodavatel] => 
                    [filialka_id] => 
                    [rok] => 
                )

        )

    [0] => Array
        (
            [expfak] => Array
                (
                    [cf_id] => 1
                    [cf_uid] => 
                    [cf_created] => 2015-08-17 12:00:00
                    [cf_modified] => 0000-00-00 00:00:00
                    [cf_created_by] => 616
                    [cf_modified_by] => 0
                    [cf_ipaddress] => 192.168.2.131
                    [cf_user_id] => 616
                    [filialka_id] => 500
                    [datum] => 2014-07-03
                    [rok] => 2014
                    [cislo_faktury] => 4140308
                    [dodavatel] => 21
                    [popis] => distr. KL_2014 léto
                    [sazba] => 21
                    [cena_bDPH] => XXXXXX
                    [dopravne_bDPH] => 0.00
                    [poznamka] => 
                    [autorizovano] => 544
                )

            [expdod] => Array
                (
                    [cf_id] => 21
                    [cf_uid] => 
                    [cf_created] => 2015-08-14 12:00:00
                    [cf_modified] => 2015-08-25 07:35:14
                    [cf_created_by] => 616
                    [cf_modified_by] => 544
                    [cf_ipaddress] => 192.168.2.131
                    [cf_user_id] => 616
                    [dodavatel] => XXXXXX
                    [ico] => XXXX
                    [dic] => 
                )

        )
This topic is locked and no more replies can be posted.