Query Parameters - Add bind parameter - 'List' check box

0

I am a new user to Wavemaker, so this should be a simple question.

When adding query parameters to a query in Wavemaker, there is a 'List' option that you can tick or untick. What does ticking or unticking this checkbox do? This checkbox is next to the Type & Name fields in the 'Add bind parameter' panel.

I was unable to find the function of this checkbox in the Wavemaker documentation.

Many thanks.

 

edc's picture

Good question.

That option allows the inputs to be a list of values, eg:
FROM Actor a WHERE a.firstName IN (:names)

A few more details and a known issue on this one:
http://jira.wavemaker.com/browse/MAV-2118

Unfortunately I do not seem to have access to the link you have provided above(re known issue).

But my next question, is on the use of my query from my web page

Is it possible to pass as input for a list parameter, the output from another query via a server variable?

If so, please let me know how to do it, as what I have tried so far has not worked. I'll probably be better off using a nested select to do what I need to do, however, I am interested in how you would actually use a list parameter from the page.

edc's picture

Sorry about that, MAV is not open like WM, so you wouldn't be able to see that MAV issue in jira. However, the issue won't help with this.

To use the output from a service variable you _must_ use a binding or the onResult event. The exact details will depend on the format of the returned query. A list of strings could just work if the input is a list of strings, but a list of objects would require extraction of the strings for the same input.

Thanks a lot edc. For all you other newbies out there, the syntax for testing the query with list values uses sqare braces:

e.g.

[john, jane]

For example if our select is:

SELECT name
FROM customer
WHERE state  IN (:param)

Specifiying the Test parameter value as [john, jane] will return all customers where the name is john or jane.

I have similar requirement, using WM 6.5M3.

I have a similar main Qyery with 'IN (:param)' and associated it to service variable (srvVar1) and it is attached to Grid.

param is taken from another Query e.g. 'select param from table2' and associated to another service variable (srvVar2).

if I attach this srvVar2 to param input of srvVar1, I am getting error 'java.lang.Long cannot be cast to com.wavemaker.json.JSONArray'

How did you resolve your issue. Could you pls share code and solution?

edc's picture

Excellent. Thanks for that.
Added your example to the Database overview page in the doc.
http://dev.wavemaker.com/wiki/bin/Database#HUsingListInputs