226
Views
3
Comments
How to add dynamic structure in SQL ?
Question

Hi Team,

 i need to create a structure based on number of inputs (attributed) typed by the user. 

How can i achieve this ?

Regards,

Shanmuk

2019-11-11 17-10-24
Manish Jawla
 
MVP

Hi shanmuk,

Can you please elaborate it with an example?

I can suggest one thing you can keep the structure as text type for generic usage and keep comma or pipe"|" for separation of records and later you filter it through the loop by using split function string on basis of that separator.

Regards,

Manish Jawla


UserImage.jpg
shanmuk sandeep

Manish Jawla wrote:

Hi shanmuk,

Can you please elaborate it with an example?

I can suggest one thing you can keep the structure as text type for generic usage and keep comma or pipe"|" for separation of records and later you filter it through the loop by using split function string on basis of that separator.

Regards,

Manish Jawla


Hi Manish, 

I have a input text box and a grid below to it.

If i type select * from employees   it will return employee details (suppose 4 attributes) into the grid. 

if i type select employee name from employee it should return only 1 attribute into the grid.

so how can i give output structure to SQL a dynamic one so that, according to number of attributes i need to retrieve dose many structure attributes should be generated dynamically.\

Here is my sample OML


Regards,

Shanmuk

DynamicQueryAnalyser.oml
2011-06-15 10-51-19
Wim van den Brink

so when i type 'delete from user'  it will display xxx records deleted ? You managed to create a nice sql injection program :-) I can even create a sql which would make my account admin on the outsystems server .. 

OutSystems isn't really very dynamic, the only way to do it is like Mansih suggested, always have a list of text as the output of the sql, and be sure to concatenate all fields together, this will require you to build a sql preprocessor changing the sql string the user typed to something you can handle.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.