How to store list of data (retrieve by sql query) in structure variable in outsystem?

How to store list of data (retrieve by sql query) in structure variable in outsystem?

  

For example, we can fetch data of a room (RoomId,RoomNumber,RoomCapacity,RoomPrice) by sql query and store them in a structure variable to show them on screen. But if we want to fectch detail of multiple rooms and store in structure variable in order to display each of the dataset on screen, how to achieve that?

Hi saikat,

can you detail out what you want. So i can help you


Thanks

Jitendra Raghuvanshi

Hi Saikat,


To get the list of data from SQL query, you are defining a structure. Its correct.

Now after getting data from your query, you can have List of your data already.


To Create a variable with structure list, you can use some tricks or traditional way.

- i.e. If your StructureName is 'RoomDetails' and you create a variable using name 'RoomDetailsList', it will automatically create your variable as list of room details.

- Or if you want to create it using traditional way, Create Variable first, then double click on Data Type property, then select 'RoomDetails' structure data type, then again open Data Type property and then select 'List'. Its a lengthy one process indeed.


So I will suggest just name your variable like 'StructureNameList', its a cool feature.


You can then assign and iterate through the variable as per your requirement.


Have a look in the attached image.


Regards,

Palak Patel

Hi,


1. Use a Web block with dataset as input to display a dataset.

2. Inside the web screen where you want to display multiple data set, use List Records with "dataset list" as input. Place the web block that you created earlier inside the list records and assign "dataset list.current" as web block input. 


Regards,

Ye Yint Shin Thant

Palak Patel wrote:

Hi Saikat,


To get the list of data from SQL query, you are defining a structure. Its correct.

Now after getting data from your query, you can have List of your data already.


To Create a variable with structure list, you can use some tricks or traditional way.

- i.e. If your StructureName is 'RoomDetails' and you create a variable using name 'RoomDetailsList', it will automatically create your variable as list of room details.

- Or if you want to create it using traditional way, Create Variable first, then double click on Data Type property, then select 'RoomDetails' structure data type, then again open Data Type property and then select 'List'. Its a lengthy one process indeed.


So I will suggest just name your variable like 'StructureNameList', its a cool feature.


You can then assign and iterate through the variable as per your requirement.


Have a look in the attached image.


Regards,

Palak Patel

Hi Saikat,

I agree with Palak, just follow the steps which Palak mentioned to you and you will find the solutions.


Thanks,

Rajat Agrawal