Search Form Results

Discussions about the LSPS expression language.
Forum rules
Make sure every topic contains information about your LSPS version and if relevant also your server OS, client OS, database name and version, and application server name and version.
User avatar
Posts: 38
Joined: Tue Mar 06, 2012 4:17 pm

Search Form Results

Fri May 03, 2013 5:07 am

I have implemented a search form that queries our custom datamodel and has optional parameters. Is there a preferred way to create the query with the optional parameters?

Maros Bajtos
Posts: 145
Joined: Mon Feb 27, 2012 2:52 pm

Re: Search Form Results

Fri May 03, 2013 11:01 am

There is no concept for optional parameters in query, you always need to specify them. However if you specify null as parameter ( or empty search box in form ) when calling the query, you can implement the following logic in the query condition:

if parameter1 != null then
record.field1 = parameter1


if parameter2 != null then
record.field2 = parameter2

This will impose constraint on field1 only if parameter1 is specified. Otherwise it will evaluate the whole if else then to true and it is ignored for the resulting query. I hope this helps.

Return to Expression language

Who is online

Users browsing this forum: No registered users and 1 guest