edjofego
5th December 2008, 21:42
Hi to all gurus!! :D
Does anyone knows how I can return a value in a dynamic sql or if this is possible? :confused:
If yes, could you give me the syntax of how to do this?
Hopefully someone of you can help me...
In advance thank you very much!!
Greetings!!
Edjofego
vinceco252
5th December 2008, 22:02
I am not sure what you mean. You get the result set of the SQL statement, and an return value to indicate if the SQL statement is valid and if it returns a result. What other result are you looking for?
Thanks,
Vince
edjofego
5th December 2008, 22:28
Hi Vince, :D
Thanks for answering, let me explain in greater detail. I have 13 queries of similar structure (the only thing that changes is the field and table for search)
select tcint010.new.suno:new.suno
from tcint010
where tcint010.old.suno = :i.suno
as set with 1 rows
selectdo
endselect
return(new.suno)
select tcint011.new.cuno:new.cuno
from tcint011
where tcint011.old.cuno = :i.cuno
as set with 1 rows
selectdo
endselect
return(new.cuno)
And to save lines of code I thought of making a dynamic SQL, something like this:
"select " & table.field1 & ":" & variable &
"from " & table &
"where " & table.field2 & " = :" & input.variable &
"as set with 1 rows"
But I do not know how to make this query returns me the variable that is hosting the field.
Thanx!
Greetings ;)
NPRao
6th December 2008, 02:40
But I do not know how to make this query returns me the variable that is hosting the field.
If you are try to find the variable's contents, you have to use expr.compile() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_expressions_runtime_expr_compile)
Also search on the forum with the keyword "expr.compile" and refer to the thread - Referential Variables? (http://www.baanboard.com/baanboard/showthread.php?t=12092&highlight=expr.compile)
edjofego
6th December 2008, 02:51
If you are try to find the variable's contents, you have to use expr.compile() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_expressions_runtime_expr_compile)
Also refer to the forum with the keyword "expr.compile" and refer to the thread - Referential Variables? (http://www.baanboard.com/baanboard/showthread.php?t=12092&highlight=expr.compile)
I'd tried using expr.compile() and It's working OK :D
NPRA & vinceco252 thank you very much for your answers. ;)
Problem Solved :cool:
See you later.
Greetings!