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

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

ExecuteSQL(

"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!

Your language settings uses , comma as decimal delimiter, executesql returns numbers with . dot as decimal delimiter, what your system just ignores. Do a replace on the result:

Substitute ( yourSqlResult ; "." ; "," )

best

Otmar