C# - applySQL. "Select sum()......"
- 2 years ago
Hi,
glad to see you haven´t given up yet! :)
Normally SQL is executed form server Method. Does your version really work from a client Method?
One issue that I notice are these two lines:
ResultadoSQL = innovator.applySQL(SentenciaSql);
// tomamos el valor de la suma
var LT_Par = ResultadoSQL.getProperty("Resultado","0");You execute the SQL, but than immediately want to read a column of the result. But you haven´t got the result item itself yet. applySQL can return multiple items!
Try something like this
Item sqlItem = ResultadoSQL.getItemByIndex(0).getProperty("Resultado","0");
To my knowledge there is no inbuilt option to make "SUM". You can replicate "Count", but for other stuff you would need a custom Method, like described here: link
But for your use case (updating multiple very specific relationships), using SQL is ok.