This topic is locked
[SOLVED]

 not export

1/22/2021 12:39:58 PM
PHPRunner General questions
L
luchoadmin author

Hello dears,
today I did a rather long query (view) in phprunner with some subqueries and some inner joins. then everything works fine but it won't let me export, it creates the file but blank.

I don't know why it happens .. any ideas

select i.Lote

, i.Fecha

, b.Barco

, i.Cajones

, avg (rp.Peso_cajon) as "Promedio"

, i.Kilogramos

, ROUND(avg(cimp.Prueba5),2) as "Temperatura"

, cimp.Apto_para

, imm.ID as "Camiones"

, i.Cajones as "Estiba"

, bl.ENTERO as "ENTERO"

, bl.COLA as "COLA"

, bl.PELADO as "PELADO"

, bl.TOTAL as "TOTAL"
, tn.ENTERO as "ENTERO CONG"

, tn.COLA as "COLA CONG"

, tn.PELADO as "PELADO CONG "

, tn.TOTAL as "TOTAL CONG"

, (((tn.TOTAL / bl.total)100)-100) as "DIF"
, en.L1 as "L1"

, (en.L1 / en.TOTAL)
100 as "L1 %"

, en.L2 as "L2"

, (en.L2/ en.TOTAL)100 as "L2 %"

, en.L3 as "L3"

, (en.L3/ en.TOTAL)
100 as "L3 %"

, en.L1BLOQUE as "L1 BLOQUE"

, (en.L1BLOQUE/ en.TOTAL)100 as "L1 BLOQUE %"

, en.L2BLOQUE as "L2 BLOQUE"

, (en.L2BLOQUE/ en.TOTAL)
100 as "L2 BLOQUE %"

, en.L3BLOQUE as "L3 BLOQUE"

, (en.L3BLOQUE/ en.TOTAL)100 as "L3 BLOQUE %"

, en.TOTAL as "TOTAL ENTERO"

, 95 as "Rendmiento Entero"

, en.C0 as "C0"

, (en.C0/ en.KILOSTOTALESCOLA)
100 as "C0 %"

, en.C1 as "C1"

, (en.C1/ en.KILOSTOTALESCOLA)100 as "C1 %"

, en.C2 as "C2"

, (en.C2/ en.KILOSTOTALESCOLA)
100 as "C2 %"

, en.C0BLOQUE as "C0 BLOQUE"

, (en.C0BLOQUE/ en.KILOSTOTALESCOLA)100 as "C0 BLOQUE %"

, en.C1BLOQUE as "C1 BLOQUE"

, (en.C1BLOQUE/ en.KILOSTOTALESCOLA)
100 as "C1 BLOQUE %"

, en.CRBLOQUE as "CR BLOQUE"

, (en.CRBLOQUE/ en.KILOSTOTALESCOLA)100 as "CR BLOQUE %"

, en.CSCBLOQUE as "C S/C BLOQUE"

, (en.CSCBLOQUE/ en.KILOSTOTALESCOLA)
100 as "C S/C BLOQUE %"

, en.C1IQF as "C1 IQF"

, (en.C1IQF/ en.KILOSTOTALESCOLA)100 as "C1 IQF %"

, en.C2IQF as "C2 IQF"

, (en.C2IQF/ en.KILOSTOTALESCOLA)
100 as "C2 IQF %"
, en.DESV as "DESV"

, (en.DESV/ en.KILOSTOTALESCOLA)100 as "DESV %"

, en.BROKEN as "BROKEN"

, (en.BROKEN/ en.KILOSTOTALESCOLA)
100 as "BROKEN %"

, en.EZP1315 as "EZP13/15"

, (en.EZP1315/ en.KILOSTOTALESCOLA)100 as "EZP13/15 %"

, en.EZP1620 as "EZP 16/20"

, (en.EZP1620/ en.KILOSTOTALESCOLA)
100 as "EZP16/20 %"

, en.EZP2125 as "EZP 21/25"

, (en.EZP2125/ en.KILOSTOTALESCOLA)100 as "EZP21/25 %"

, en.EZP2630 as "EZP 26/30"

, (en.EZP2630/ en.KILOSTOTALESCOLA)
100 as "EZP26/30 %"

, en.DESVTAILONIQF as "DESV TAIL-ON IQF"

, (en.DESVTAILONIQF/ en.KILOSTOTALESCOLA)100 as "DESV TAIL-ON IQF %"
, en.KILOSTOTALESCOLA as "KILOS TOTALES COLA"

, ROUND((en.KILOSTOTALESCOLA /(i.Kilogramos -(en.TOTAL / 0.95 ))
100),2) as "Rendmiento Cola"

, en.STOCKTOTAL as "STOCK TOTAL"

, (en.STOCKTOTAL / i.Kilogramos)*100 as "% TOTAL"
from Ingreso i

join Barcos b on b.Matricula = i.Barco

left join Remito_promedio rp on rp.Lote = i.Lote

left join cali_ingreso_mat_prima cimp on cimp.Lote = i.Lote

left join (

SELECT imm.Lot, COUNT(imm.ID) AS ID FROM ingreso_mt imm GROUP BY imm.Lot

) imm on imm.Lot = i.Lote

left join (

select distinct lp.Lote

, sum( if( p.Tipo_Producto = 'ENTERO LINEAS', lp.Total, null ) ) as "ENTERO"

, sum( if( p.Tipo_Producto = 'COLA LINEAS', lp.Total, null ) ) as "COLA"

, sum( if( p.Tipo_Producto = 'PELADO LINEAS', lp.Total, null ) ) as "PELADO"

, sum( if( p.Tipo_Producto in ( 'ENTERO LINEAS', 'COLA LINEAS', 'PELADO LINEAS' ), lp.Total, null ) ) as "TOTAL"

from Lineas_Produccion lp

join Productos p on p.Producto = lp.Producto

where p.Tipo_Producto is not null

group by lp.Lote

) as bl on bl.Lote = i.Lote

left join (

select distinct c.Lote

, sum( if( p.Tipo_Producto = 'ENTERO', c.Kilogramos, null ) ) as "ENTERO"

, sum( if( p.Tipo_Producto = 'COLA', c.Kilogramos, null ) ) as "COLA"

, sum( if( p.Tipo_Producto = 'PELADO', c.Kilogramos, null ) ) as "PELADO"

, sum( if( p.Tipo_Producto in ( 'ENTERO', 'COLA', 'PELADO' ), c.Kilogramos, null ) ) as "TOTAL"

from Congelado c

join Productos p on p.Producto = c.Producto

where p.Tipo_Producto is not null

group by c.Lote

) as tn on tn.Lote = i.Lote

left join (

select distinct e.Lote

, sum( if( p.Tipo_SubProducto = 'L1', e.Kilogramos, null ) ) as "L1"

, sum( if( p.Tipo_SubProducto = 'L2', e.Kilogramos, null ) ) as "L2"

, sum( if( p.Tipo_SubProducto = 'L3', e.Kilogramos, null ) ) as "L3"

, sum( if( p.Tipo_SubProducto = 'L1 BLOQUE', e.Kilogramos, null ) ) as "L1BLOQUE"

, sum( if( p.Tipo_SubProducto = 'L2 BLOQUE', e.Kilogramos, null ) ) as "L2BLOQUE"

, sum( if( p.Tipo_SubProducto = 'L3 BLOQUE', e.Kilogramos, null ) ) as "L3BLOQUE"

, sum( if( p.Tipo_SubProducto in ( 'L1', 'L2', 'L3', 'L1 BLOQUE', 'L2 BLOQUE', 'L3 BLOQUE' ), e.Kilogramos, null ) ) as "TOTAL"

, 95 as "rendimiento_entero"

, sum( if( p.Tipo_SubProducto = 'C0', e.Kilogramos, null ) ) as "C0"

, sum( if( p.Tipo_SubProducto = 'C1', e.Kilogramos, null ) ) as "C1"

, sum( if( p.Tipo_SubProducto = 'C2', e.Kilogramos, null ) ) as "C2"

, sum( if( p.Tipo_SubProducto = 'C0 BLOQUE', e.Kilogramos, null ) ) as "C0BLOQUE"

, sum( if( p.Tipo_SubProducto = 'C1 BLOQUE', e.Kilogramos, null ) ) as "C1BLOQUE"

, sum( if( p.Tipo_SubProducto = 'CR BLOQUE', e.Kilogramos, null ) ) as "CRBLOQUE"

, sum( if( p.Tipo_SubProducto = 'C S/C BLOQUE', e.Kilogramos, null ) ) as "CSCBLOQUE"

, sum( if( p.Tipo_SubProducto = 'C1 IQF', e.Kilogramos, null ) ) as "C1IQF"

, sum( if( p.Tipo_SubProducto = 'C2 IQF', e.Kilogramos, null ) ) as "C2IQF"
, sum( if( p.Tipo_SubProducto = 'DESV', e.Kilogramos, null ) ) as "DESV"

, sum( if( p.Tipo_SubProducto = 'BROKEN', e.Kilogramos, null ) ) as "BROKEN"

, sum( if( p.Tipo_SubProducto = 'EZP13/15', e.Kilogramos, null ) ) as "EZP1315"

, sum( if( p.Tipo_SubProducto = 'EZP 16/20', e.Kilogramos, null ) ) as "EZP1620"

, sum( if( p.Tipo_SubProducto = 'EZP 21/25', e.Kilogramos, null ) ) as "EZP2125"

, sum( if( p.Tipo_SubProducto = 'EZP 26/30', e.Kilogramos, null ) ) as "EZP2630"

, sum( if( p.Tipo_SubProducto = 'DESV TAIL-ON IQF', e.Kilogramos, null ) ) as "DESVTAILONIQF"

, sum( if( p.Tipo_SubProducto in ( 'C0', 'C1', 'C2', 'C0 BLOQUE', 'C1 BLOQUE', 'CR BLOQUE', 'C S/C BLOQUE', 'C1 IQF', 'C2 IQF', 'DESV', 'BROKEN', 'EZP13/15','EZP 16/20', 'EZP 21/25', 'EZP 26/30', 'DESV TAIL-ON IQF' ), e.Kilogramos, null ) ) as "KILOSTOTALESCOLA"

, sum( if( p.Tipo_SubProducto in ( 'L1', 'L2', 'L3', 'L1 BLOQUE', 'L2 BLOQUE', 'L3 BLOQUE', 'C0', 'C1', 'C2', 'C0 BLOQUE', 'C1 BLOQUE', 'CR BLOQUE', 'C S/C BLOQUE', 'C1 IQF', 'C2 IQF', 'DESV', 'BROKEN', 'EZP13/15','EZP 16/20', 'EZP 21/25', 'EZP 26/30', 'DESV TAIL-ON IQF' ), e.Kilogramos, null ) ) as "STOCKTOTAL"
from Enmastado e

join Productos p on p.Producto = e.Producto

where p.Tipo_Producto is not null

group by e.Lote

) as en on en.Lote = i.Lote

group by i.Lote

, i.Fecha

, b.Barco

, imm.ID

, cimp.Apto_para

, i.Cajones

, i.Kilogramos

, bl.ENTERO

, bl.COLA

, bl.PELADO

, bl.TOTAL

order by i.Fecha DESC

woodey2002 1/23/2021

Is there an option to choose which fields to export in the "fields" tab of phprunner, usually you just need tick the corresponding fields export option?
Not too sure how this handles subqueries etc. but it's worth a look.
https://xlinesoft.com/phprunner/docs/choose_fields.htm
Cheers,

J

Sergey Kornilov admin 1/24/2021

Besides selecting the export fields you can also try creating a view on your database based on this SQL query. Then add this view to your project and it should work as expected.

L
luchoadmin author 1/25/2021



Besides selecting the export fields you can also try creating a view on your database based on this SQL query. Then add this view to your project and it should work as expected.


Hello, I have reviewed the options raised and I still have the same error.

when I export the excel I get all the column names but not the data

thanck you

Sergey Kornilov admin 1/27/2021

You need to explain what exactly you have done. It is not possible that you are having exactly the same situation after creating a view in your database.

L
luchoadmin author 1/27/2021



You need to explain what exactly you have done. It is not possible that you are having exactly the same situation after creating a view in your database.


Hello, how are you?

Create the following view,

It is the same query as the previous one but based on the date
CREATE View ANUAL AS

select Date_format(q.Fecha, '%Y-%m') as "Fecha de producción"

, sum( q.Cajones ) as "Cajones"

, avg( q.promedio ) as "Promedio"

, sum( q.Kilogramos ) as "Kilogramos"

, avg( q.Prueba5 ) as "Temperatura"

, sum( q.camiones ) as "Camiones"

, sum( q.ENTERO ) as "ENTERO"

, sum( q.COLA ) as "COLA"

, sum( q.PELADO ) as "PELADO"

, sum( q.TOTAL ) as "TOTAL"
, sum( q.ENTEROCONG ) as "ENTERO CONG"

, sum( q.COLACONG ) as "COLA CONG"

, sum( q.PELADOCONG ) as "PELADO CONG"

, sum( q.TOTALCONG ) as "TOTAL CONG"

, sum( q.TOTAL ) / sum( q.TOTALCONG ) as "DIF"
, sum( q.L1 ) as "L1"

, sum( q.L2 ) as "L2"

, sum( q.L3 ) as "L3"

, sum( q.L1BLOQUE ) as "L1 BLOQUE"

, sum( q.L2BLOQUE ) as "L2 BLOQUE"

, sum( q.L3BLOQUE ) as "L3 BLOQUE"

, sum( q.LBloqueSC ) as "L Bloque S/C"

, sum( q.TOTALENTERO ) as "TOTAL ENTERO"

, 95 as "Rendmiento Entero"

, sum( q.C0 ) as "C0"

, sum( q.C1 ) as "C1"

, sum( q.C2 ) as "C2"

, sum( q.C0BLOQUE ) as "C0 BLOQUE"

, sum( q.C1BLOQUE ) as "C1 BLOQUE"

, sum( q.CRBLOQUE ) as "CR BLOQUE"

, sum( q.CSCBLOQUE ) as "C S/C BLOQUE"

, sum( q.C1IQF ) as "C1 IQF"

, sum( q.C2IQF ) as "C2 IQF"
, sum( q.DESV ) as "DESV"

, sum( q.BROKEN ) as "BROKEN"

, sum( q.EZP1315 ) as "EZP13/15"

, sum( q.EZP1620 ) as "EZP 16/20"

, sum( q.EZP2125 ) as "EZP 21/25"

, sum( q.EZP2630 ) as "EZP 26/30"

, sum( q.DESVTAILONIQF ) as "DESV TAIL-ON IQF"
, sum( q.KILOSTOTALESCOLA ) as "KILOS TOTALES COLA"

, avg( q.KILOSTOTALESCOLA ) / sum( q.TOTAL ) / 0.95 100 as "Rendmiento Cola"

, sum( q.STOCKTOTAL ) as "STOCK TOTAL"

, avg( q.STOCKTOTAL) / sum( q.Kilogramos )
100 as "% TOTAL"

from (

select i.Lote

, i.Fecha

, b.Barco

, i.Cajones

, rp.promedio

, i.Kilogramos

, cimp.Prueba5

, cimp.Apto_para

, im.camiones

, bl.ENTERO

, bl.COLA

, bl.PELADO

, bl.TOTAL
, tn.ENTERO as "ENTEROCONG"

, tn.COLA as "COLACONG"

, tn.PELADO as "PELADOCONG"

, tn.TOTAL as "TOTALCONG"

, tn.TOTAL / bl.total as "DIF"
, en.L1

, en.L2

, en.L3

, en.L1BLOQUE

, en.L2BLOQUE

, en.L3BLOQUE

, en.LBloqueSC

, en.TOTAL as "TOTALENTERO"

, 95 as "Rendmiento Entero"

, en.C0

, en.C1

, en.C2

, en.C0BLOQUE

, en.C1BLOQUE

, en.CRBLOQUE

, en.CSCBLOQUE

, en.C1IQF

, en.C2IQF
, en.DESV

, en.BROKEN

, en.EZP1315

, en.EZP1620

, en.EZP2125

, en.EZP2630

, en.DESVTAILONIQF
, en.KILOSTOTALESCOLA

, en.STOCKTOTAL
from Ingreso i

join Barcos b on b.Matricula = i.Barco

left join (select r.Lote, avg(r.Peso_Cajon) as promedio from Remito_promedio r group by r.Lote) rp on rp.Lote = i.Lote

left join (select ip.Lote , max(ip.Apto_para) as Apto_para, ROUND(avg(ip.Prueba5),2) Prueba5 from cali_ingreso_mat_prima ip group by ip.Lote ) cimp on cimp.Lote = i.Lote

left join (select m.Lot, count(1) as Camiones from ingreso_mt m group by m.Lot ) im on im.Lot = i.Lote

left join (

select distinct lp.Lote

, sum( if( p.Tipo_Producto = 'ENTERO LINEAS', lp.Total, null ) ) as "ENTERO"

, sum( if( p.Tipo_Producto = 'COLA LINEAS', lp.Total, null ) ) as "COLA"

, sum( if( p.Tipo_Producto = 'PELADO LINEAS', lp.Total, null ) ) as "PELADO"

, sum( if( p.Tipo_Producto in ( 'ENTERO LINEAS', 'COLA LINEAS', 'PELADO LINEAS' ), lp.Total, null ) ) as "TOTAL"

from Lineas_Produccion lp

join Productos p on p.Producto = lp.Producto

where p.Tipo_Producto is not null

group by lp.Lote

) as bl on bl.Lote = i.Lote

left join (

select distinct c.Lote

, sum( if( p.Tipo_Producto = 'ENTERO', c.Kilogramos, null ) ) as "ENTERO"

, sum( if( p.Tipo_Producto = 'COLA', c.Kilogramos, null ) ) as "COLA"

, sum( if( p.Tipo_Producto = 'PELADO', c.Kilogramos, null ) ) as "PELADO"

, sum( if( p.Tipo_Producto in ( 'ENTERO', 'COLA', 'PELADO' ), c.Kilogramos, null ) ) as "TOTAL"

from Congelado c

join Productos p on p.Producto = c.Producto

where p.Tipo_Producto is not null

group by c.Lote

) as tn on tn.Lote = i.Lote

left join (

select distinct e.Lote

, sum( if( p.Tipo_SubProducto = 'L1', e.Kilogramos, null ) ) as "L1"

, sum( if( p.Tipo_SubProducto = 'L2', e.Kilogramos, null ) ) as "L2"

, sum( if( p.Tipo_SubProducto = 'L3', e.Kilogramos, null ) ) as "L3"

, sum( if( p.Tipo_SubProducto = 'L1 BLOQUE', e.Kilogramos, null ) ) as "L1BLOQUE"

, sum( if( p.Tipo_SubProducto = 'L2 BLOQUE', e.Kilogramos, null ) ) as "L2BLOQUE"

, sum( if( p.Tipo_SubProducto = 'L3 BLOQUE', e.Kilogramos, null ) ) as "L3BLOQUE"

, sum( if( p.Tipo_SubProducto = 'L Bloque S/C', e.Kilogramos, null ) ) as "LBloqueSC"

, sum( if( p.Tipo_SubProducto in ( 'L1', 'L2', 'L3', 'L1 BLOQUE', 'L2 BLOQUE', 'L3 BLOQUE', 'L Bloque S/C' ), e.Kilogramos, null ) ) as "TOTAL"

, 95 as "rendimiento_entero"

, sum( if( p.Tipo_SubProducto = 'C0', e.Kilogramos, null ) ) as "C0"

, sum( if( p.Tipo_SubProducto = 'C1', e.Kilogramos, null ) ) as "C1"

, sum( if( p.Tipo_SubProducto = 'C2', e.Kilogramos, null ) ) as "C2"

, sum( if( p.Tipo_SubProducto = 'C0 BLOQUE', e.Kilogramos, null ) ) as "C0BLOQUE"

, sum( if( p.Tipo_SubProducto = 'C1 BLOQUE', e.Kilogramos, null ) ) as "C1BLOQUE"

, sum( if( p.Tipo_SubProducto = 'CR BLOQUE', e.Kilogramos, null ) ) as "CRBLOQUE"

, sum( if( p.Tipo_SubProducto = 'C S/C BLOQUE', e.Kilogramos, null ) ) as "CSCBLOQUE"

, sum( if( p.Tipo_SubProducto = 'C1 IQF', e.Kilogramos, null ) ) as "C1IQF"

, sum( if( p.Tipo_SubProducto = 'C2 IQF', e.Kilogramos, null ) ) as "C2IQF"
, sum( if( p.Tipo_SubProducto = 'DESV', e.Kilogramos, null ) ) as "DESV"

, sum( if( p.Tipo_SubProducto = 'BROKEN', e.Kilogramos, null ) ) as "BROKEN"

, sum( if( p.Tipo_SubProducto = 'EZP13/15', e.Kilogramos, null ) ) as "EZP1315"

, sum( if( p.Tipo_SubProducto = 'EZP 16/20', e.Kilogramos, null ) ) as "EZP1620"

, sum( if( p.Tipo_SubProducto = 'EZP 21/25', e.Kilogramos, null ) ) as "EZP2125"

, sum( if( p.Tipo_SubProducto = 'EZP 26/30', e.Kilogramos, null ) ) as "EZP2630"

, sum( if( p.Tipo_SubProducto = 'DESV TAIL-ON IQF', e.Kilogramos, null ) ) as "DESVTAILONIQF"

, sum( if( p.Tipo_SubProducto in ( 'C0', 'C1', 'C2', 'C0 BLOQUE', 'C1 BLOQUE', 'CR BLOQUE', 'C S/C BLOQUE', 'C1 IQF', 'C2 IQF', 'DESV', 'BROKEN', 'EZP13/15','EZP 16/20', 'EZP 21/25', 'EZP 26/30', 'DESV TAIL-ON IQF' ), e.Kilogramos, null ) ) as "KILOSTOTALESCOLA"

, sum( if( p.Tipo_SubProducto in ( 'L1', 'L2', 'L3', 'L1 BLOQUE', 'L2 BLOQUE', 'L3 BLOQUE', 'L Bloque S/C', 'C0', 'C1', 'C2', 'C0 BLOQUE', 'C1 BLOQUE', 'CR BLOQUE', 'C S/C BLOQUE', 'C1 IQF', 'C2 IQF', 'DESV', 'BROKEN', 'EZP13/15','EZP 16/20', 'EZP 21/25', 'EZP 26/30', 'DESV TAIL-ON IQF' ), e.Kilogramos, null ) ) as "STOCKTOTAL"
from Enmastado e

join Productos p on p.Producto = e.Producto

where p.Tipo_Producto is not null

group by e.Lote

) as en on en.Lote = i.Lote

) q

group by Date_format(q.Fecha, '%Y-%m')

order by Date_format(q.Fecha, '%Y-%m') DESC
then in sql query editor

SELECT * FROM ANUAL
IN choosekey columns uncheck fields.

in choose fields exporte select all

but the ahivo still comes out blank

https://drive.google.com/file/d/1Q7DGBKyB-MN1VzUMEX6SiBYz0xGmLo9p/view?usp=sharing

https://drive.google.com/drive/folders/14-ScQfxt8ZSbPzpQj--D52BO6t2VwoL7?usp=sharing
thank you

L
luchoadmin author 2/8/2021

any ideas to fix this problem?

Thank you

Sergey Kornilov admin 2/8/2021

I suggest posting your project to Demo Account and contacting the support team directly.
It looks like you are doing it right and we would need to see the actual project in order to find what is wrong.

L
luchoadmin author 2/19/2021



I suggest posting your project to Demo Account and contacting the support team directly.
It looks like you are doing it right and we would need to see the actual project in order to find what is wrong.


fixed, I had to update to the latest version of 10.4