133
Views
4
Comments
Solved
extension return sql data
Question

Dear all,

I have been scratching my head the whole day trying to find a way to properly export DB results from IDataReader object to my output RecordList object in C#.

What is the best and most efficient way to do this? Is there a way to make it generic and work independently of the type of the output?

Thank you.

2025-04-23 09-24-58
oDevFagundes
Champion
Solution

Hello André, I'm wondering if what do you want already exist in the forge.
There's a extension called Advance Query able to execute SQLs and throw the results "dynamically" to any Outsystems struct like Advance Query does.

You can open that extension and see how it works!
Let me know if you enjoy that and makes this question solved if your ask was answer.

Kind Regards,
Paulo Fagundes

UserImage.jpg
Andre Goncalves

Paulo Fagundes Jr. wrote:

Hello André, I'm wondering if what do you want already exist in the forge.
There's a extension called Advance Query able to execute SQLs and throw the results "dynamically" to any Outsystems struct like Advance Query does.

You can open that extension and see how it works!
Let me know if you enjoy that and makes this question solved if your ask was answer.

Kind Regards,
Paulo Fagundes


Thank you everyone for helping us out, and giving more insight's on how the platform works with your answers.

@Paulo Fagundes Jr. indeed you forge component did the job and worked like a charm. We just had to tweak it a little bit by creating a Regex to search for all occurrences of the words "insert" or "update" outside a pair of quote marks (select * from x('insert') is accepted, but insert' or select * from x('dsd'); insert into x ... are not accepted).

Kind regards,

André


2019-06-15 21-39-22
Afonso Carvalho
 
MVP

Hi Andre,

The issue is that once you exit the context of your extension, your output is a structure, and those are static.

The trick is that you can have a generic input (a structure/list that you convert to a generic Object with the ToObject() action). Perform your changes to it, and those changes will be accessible in the OutSystems context without sending it back as an output. If you want a good example of this, the XMLRecords extension is capable of processing any XML definition - I think the XmlToRecordList action is a very good example of the generic extension logic you're looking for.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Though Afonso is right, the downside of that is that you need to properly understand the way that Lists and Record Lists are structured internally, which is no mean feat :).

The main problem with a generic output is that OutSystems apps are very strongly typed: everything has a type, and though you can convert between types in various ways, a Variable (or Parameter) has a single type, and will always be that type (so it has static type checking). This makes it impossible to have a generic, unspecified, data type out of an Extension.

2025-04-23 09-24-58
oDevFagundes
Champion
Solution

Hello André, I'm wondering if what do you want already exist in the forge.
There's a extension called Advance Query able to execute SQLs and throw the results "dynamically" to any Outsystems struct like Advance Query does.

You can open that extension and see how it works!
Let me know if you enjoy that and makes this question solved if your ask was answer.

Kind Regards,
Paulo Fagundes

UserImage.jpg
Andre Goncalves

Paulo Fagundes Jr. wrote:

Hello André, I'm wondering if what do you want already exist in the forge.
There's a extension called Advance Query able to execute SQLs and throw the results "dynamically" to any Outsystems struct like Advance Query does.

You can open that extension and see how it works!
Let me know if you enjoy that and makes this question solved if your ask was answer.

Kind Regards,
Paulo Fagundes


Thank you everyone for helping us out, and giving more insight's on how the platform works with your answers.

@Paulo Fagundes Jr. indeed you forge component did the job and worked like a charm. We just had to tweak it a little bit by creating a Regex to search for all occurrences of the words "insert" or "update" outside a pair of quote marks (select * from x('insert') is accepted, but insert' or select * from x('dsd'); insert into x ... are not accepted).

Kind regards,

André


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