Hello to all
I have a strange situation during different execution of a query:
The query is:
What i'm trying to obtain is a list of products and for each month with a value, it
add the quantity bought/sold in a cell.
When the query is executed the 1st time, the result is correct.
Using the same parameters and trying to execute the query a second time, the result is
totally different and without errors or other issues.
Pratically in the table are shown only the code and product name, despite using the debug i see the correct value in the variable, but it is not shown on the table...Why??
Do i missing something??
Thanks in advance
Gianni
This is the table used:
[attachment 2283 scheda.png]
I have a strange situation during different execution of a query:
The query is:
sSql="SELECT mag.codice, mag.descrizione, MONTH(mov.data_mov) AS mese, SUM(mov.qta) AS qtaAcq "
sSql+=" FROM movimenti as mov INNER JOIN magazzino AS mag ON mov.codice_articolo=mag.codice "
sSql+=" WHERE mov.causale BETWEEN 200 AND 202 "
sSql+=" AND mov.anno_mov="+nAnno
sSql+=" AND mag.fornitore_abituale="+nFornitore
sSql+=" GROUP BY mag.codice, MONTH(mov.data_mov)"
bRes=HExecuteSQLQuery(dsMyQueryAcq,MyConnection1,hQueryWithoutCorrection,sSql)
IF bRes=False THEN
Info ("Errore durante l'elaborazione sul database"+CR+CR+HErrorInfo())
RETURN
ELSE
bDati=HReadFirst (dsMyQueryAcq)
IF bDati THEN
WHILE NOT HOut ()
IF dsMyQueryAcq.codice <> "" THEN
// if dsMyQueryAcq.codice="919947" THEN
// info ("stop!")
// END
IF sUltCodice <> dsMyQueryAcq.codice THEN
IF nRiga > 0 THEN
FOR j=1 TO 12
nTotale+={"Table_acquisti.col_mese"+j}[nRiga]
END
TABLE_Acquisti.COL_Totali[nRiga]=nTotale
END
TableAdd (TABLE_Acquisti,dsMyQueryAcq.codice+TAB+dsMyQueryAcq.descrizione)
nTrovati+=1
nRiga=TABLE_Acquisti..Occurrence
sUltCodice=dsMyQueryAcq.codice
nTotale=0
nMese=dsMyQueryAcq.mese
{"table_acquisti.col_mese"+nMese}[nRiga]=dsMyQueryAcq.qtaAcq
ELSE
nMese=dsMyQueryAcq.mese
{"table_acquisti.col_mese"+nMese}[nRiga]=dsMyQueryAcq.qtaAcq
END
END
HReadNext ()
END
END
END
What i'm trying to obtain is a list of products and for each month with a value, it
add the quantity bought/sold in a cell.
When the query is executed the 1st time, the result is correct.
Using the same parameters and trying to execute the query a second time, the result is
totally different and without errors or other issues.
Pratically in the table are shown only the code and product name, despite using the debug i see the correct value in the variable, but it is not shown on the table...Why??
Do i missing something??
Thanks in advance
Gianni
This is the table used:
[attachment 2283 scheda.png]