15
Views
3
Comments
Solved
SQL output variable
Question

Hi 

This is properly a newbee question, but I havn't been able to find the right way to do it in the guides.

How do I get an list of data out from my SQL in a  Server Action, so I can use it in my Client Action? 

I think, I right now just override the output variable in my server action loop, so I just get the last one in my output variable instead of a list, but I'n not sure that is the problem...

I also supect my assign the the Client Action to be faulty, it is made that way because I don't get a list as output from the Server Action.

Server Action



Client Action


Rank: #68
Solution

Hi Claus,

Your server action must have a list as an output parameter.

This 'For Each' is also not necessary. You can assign the result of the query directly to a variable of type list, without having to iterate the result of the query.

See this sample oml.

List.oml

Rank: #94

Hello Claus,

Hope you're doing well.

Most likely, your output of the Server Action should be a List variable.


Since your query just retrieves the Id and the Name attributes from your AvailableSkills entity, you should probably consider to create a Structure with those 2 attributes. And then you can use a List of that structure as an output parameter in your Server Action.


In your loop, you'll need to use a ListAppend system action:

Where you should append the elements of your SQL query to that List variable.

You may also consider to use ListAppendAll action instead, just to avoid the loop :)


Hope that this helps you!


Kind regards,

Rui Barradas

Rank: #68
Solution

Hi Claus,

Your server action must have a list as an output parameter.

This 'For Each' is also not necessary. You can assign the result of the query directly to a variable of type list, without having to iterate the result of the query.

See this sample oml.

List.oml

Rank: #44200

Thank you guys for quick and good answers. :)


What I needed was to set the output variables Data Type to a list, as you mentions.