How to Execute an SQL query passed as input parameter(text) from UI Page

Hi,

I have a UI page with Textbox  from which i am passing the SQL Query(ex: select {User}.* from {User}) as text and passing this text as input parameter to the advanced query in the button action,if i run the query manually,it works fine ,if i pass the query as parameter i am getting error as attached in screenshot.

could you please suggest me how to pass query as parameter to advanced SQL.

Please check the attachments for reference.looking forward for your solution.

Thanks in advance.



bhagya br wrote:

Hi,

I have a UI page with Textbox  from which i am passing the SQL Query(ex: select {User}.* from {User}) as text and passing this text as input parameter to the advanced query in the button action,if i run the query manually,it works fine ,if i pass the query as parameter i am getting error as attached in screenshot.

could you please suggest me how to pass query as parameter to advanced SQL.

Please check the attachments for reference.looking forward for your solution.

Thanks in advance.



Hi Bhagya,

Did you try using the encodeSQL() function on your input parameter? This function will translate special characters in your input string, in order for you to be able to use those characters in the SQL.

Kind regards,
Glenn

glenn michiels wrote:

bhagya br wrote:

Hi,

I have a UI page with Textbox  from which i am passing the SQL Query(ex: select {User}.* from {User}) as text and passing this text as input parameter to the advanced query in the button action,if i run the query manually,it works fine ,if i pass the query as parameter i am getting error as attached in screenshot.

could you please suggest me how to pass query as parameter to advanced SQL.

Please check the attachments for reference.looking forward for your solution.

Thanks in advance.



Hi Bhagya,

Did you try using the encodeSQL() function on your input parameter? This function will translate special characters in your input string, in order for you to be able to use those characters in the SQL.

Kind regards,
Glenn

Hello Glenn,


Thanks for your response.

Yep i tried that as well,still its throwing the same error.

Regards,

Bhagya


bhagya br wrote:

glenn michiels wrote:

bhagya br wrote:

Hi,

I have a UI page with Textbox  from which i am passing the SQL Query(ex: select {User}.* from {User}) as text and passing this text as input parameter to the advanced query in the button action,if i run the query manually,it works fine ,if i pass the query as parameter i am getting error as attached in screenshot.

could you please suggest me how to pass query as parameter to advanced SQL.

Please check the attachments for reference.looking forward for your solution.

Thanks in advance.



Hi Bhagya,

Did you try using the encodeSQL() function on your input parameter? This function will translate special characters in your input string, in order for you to be able to use those characters in the SQL.

Kind regards,
Glenn

Hello Glenn,


Thanks for your response.

Yep i tried that as well,still its throwing the same error.

Regards,

Bhagya


Hi Glenn,

Its working now,i made a mistake in output structure in my code.

Thank  You :)

Regards,

Bhagya



bhagya br wrote:

bhagya br wrote:

glenn michiels wrote:

bhagya br wrote:

Hi,

I have a UI page with Textbox  from which i am passing the SQL Query(ex: select {User}.* from {User}) as text and passing this text as input parameter to the advanced query in the button action,if i run the query manually,it works fine ,if i pass the query as parameter i am getting error as attached in screenshot.

could you please suggest me how to pass query as parameter to advanced SQL.

Please check the attachments for reference.looking forward for your solution.

Thanks in advance.



Hi Bhagya,

Did you try using the encodeSQL() function on your input parameter? This function will translate special characters in your input string, in order for you to be able to use those characters in the SQL.

Kind regards,
Glenn

Hello Glenn,


Thanks for your response.

Yep i tried that as well,still its throwing the same error.

Regards,

Bhagya


Hi Glenn,

Its working now,i made a mistake in my code.

Thank  You :)

Regards,

Bhagya



Bhagya,

Good to hear you got it working.

Regards,
Glenn