Strange issue with executesql in FM

Discussion created by valteri on Aug 30, 2018
Latest reply on Aug 31, 2018 by valteri

Hi, a SQL/FM newbie asking for a help...


I am having a strange issue using executesql in SQL. My script is:




"SELECT sum( Payment )

FROM Pagamentos

WHERE Fornecedores = ? and MesAnoReferenciaDRE = ?"

; "" ; "" ; "DAMSP" ; "06/" & ContratosSite::AnoResumo )


The Field "Payment" ( when "Fornecedores" = "DAMSP" & "MesAnoReferenciaDRE" = "06/" & "ContratosSite::AnoResumo" = 2018 ) is 156,95 but the SQL result shows me 15.695 (100x greater).


I've seeing this issue with other sum's too so I tested and even when it's a single result it shows me a result 100x greater than the original.


Payment is a number field and I can type any number there.


The equivalent calculation that works is:

If ( Fornecedores = "DAMSP" and MesAnoReferenciaDRE = "06/" & ContratosSite::AnoResumo ; Sum ( Payment ) ; 0 )


I can use this calculation but since I am using it with a Summary (and I have one to each month) it's taking a lot of time to process all the summaries that's why I was thinking to try executesql but I do not know what I am missing in this sql lines.


thanks t lot!