Hello. I have a LIST OF TEXT that I would like to use as a parameter for a query.  for example:

List: Carlos, Joshua, Amy....

I would like to use a select statement with that list of text as a parameter for the where clause as:

SELECT

FROM MyDatabase

WHERE FirstName = @List           (here I would probably have to use IN(@List)


However, I don't think it is working correctly. 


Thank you for the help!

Hi Vinicius,

Yes you need to use IN, in List properties change to yes the expand inline and the LIst needs to have the correct format : 'Carlos', 'Joshua', 'Amy'....

if you still have problems with it let us know which error are you getting.

Regards,

Marcelo

Hello, my list is being pulled from a database, so it doesn't come in that format. Is there a way I can format it to be separated by commas (I think) and around marks?

Thank you Marcelo!

Solution

Hey Vinicius,

If you are already fetching from the database, why not do something like:

WHERE FirstName IN (SELECT NAME FROM MYLISTENTITY)

OR

WHERE FirstName Exists (SELECT 1 From MyListEntity WHERE MyListEntity.Name like FirstName)

If you insist on using your list as an input, you will have to use something like list_join, where you join it with a comma (,) and use that within the IN () block.

Solution

Hello,

1º - Transform your list into a text field.

2ª - Put your query parameter as expand inline.



For Example.

List = "Carlos, Joshua, Amy"


SELECT * 

FROM MyDatabase

WHERE FirstName in (@List )


Thank you all, I have found an issue with my List. I was using a widget called Multiple Selection:

https://www.outsystems.com/forge/component-overview/3686/multipleselection

And it "gave" me a comma separated value instead of a list, but that on itself is not working. 

Let me fix that first and then I'll try your suggestions.

thank you!