Please a hand, to know which variable to use - Forum

Forum Navigation
You need to log in to create posts and topics.

Please a hand, to know which variable to use

@luishp,@emo,@vadim,@gaev

Friends, please, I need a hand... I have this operation that adds all the records in the ccredits column of a certain user, it does it perfectly, but I can't use the variable to take the result. I put a variable in it, but it doesn't bring me anything. ..

Any idea of which variable and how I should use it to be able to take the result of the sum?

 

dbpExecSQL "control" "SELECT SUM(ccreditos) FROM opera WHERE cajero = [#34][cajero][#34]|" "[saldo]"

 

Amigos por favor necesito una manito... tengo esta operacion que suma todos los registros de la columna ccreditos de un determinado usuario lo hace perfectamente pero no logro poder usar la variable para tomar el resultado yo le puse una variable pero no me trae nada...

Alguna idea de que variable y como debo utilizarla para poder tomar el resultado de la suma?

 

Mil gracias

@joferar333

but I can't use the variable to take the result. I put a variable in it, but it doesn't bring me anything. ..

On this page ... https://neodbprohelp.visualneo.com/AdvancedSQL.html#dbpExecSQL ... it says ...

dbpExecSQL "database id" "SQL" "results table"

database id
The name assigned to the database where the SQL commands will be executed.

SQL
The SQL commands to execute. As required by SQL conventions, multiple commands must separated with semicolons (;).

results table (optional)
This parameter can be used to enter the name of the table where you want the results of the query to be displayed. This may be the name of an existing database table or it can be a temporary table. If the table specified does not exist in the database, it is assumed to be a temporary table. Leave this parameter blank to auto detect the table name or if the query does not return any results.

A temporary table exists only while your publication is running and is not physically part of the database. However, most temporary tables derive their contents from real data, so any edits you make may affect other tables. A temporary table created with dpbExecSQL can be opened with the dbpOpenTable and displayed with dbpShowGrid actions. Actions that require a physical table, such as dbpAddField or dbpQuery, cannot be used with a temporary table.

... so the final parameter is NOT a variable but a temporary Table.

In order to extract the content that you seek, the example on this same page shows how ...

dbpExecSQL "AddrBook" "SELECT * FROM Contacts WHERE State = 'NY'" "Temp1"
dbpOpenTable "AddrBook" "Temp1" ""
dbpShowGrid "AddrBook" "Temp1" "Rectangle1"

... once you can see the the field/column associated with the resulting record(s), you can use regular dbp commands to extract the required information into a VisualNEO variable.

luishp has reacted to this post.
luishp