Re: [Dev] Null value validator in DSS

2018-04-06 Thread Vanjikumaran Sivajothy
However, you can send Query isnt it?

https://www.techonthenet.com/mysql/is_not_null.php

On Fri, Apr 6, 2018 at 1:15 PM, Chanika Geeganage  wrote:

> +dev@wso2.org
>
> Hi Laslo,
>
> There are certain validators you can define for input parameter as listed
> in [1]. There is no null validator as such, but you can write a custom
> validator. This just validate the input parameter before executing the
> query, but there is no way to change the result set.
>
> For your usecase I would suggest to configure the query with a
> QUERY_STRING parameter [2], where it allows you to pass a part of the query
> in the runtime. For an example, the query would be,
>
> 
>   select * from Inventory :filterQuery
>   
>  
>  ..
>   
>   
>
>
>  Then at the run time you can pass either the were clause or 'LIMIT 5' to
> filter out the top 5. If you pass an empty parameter it will retrieve all
> the entries.
>
> [1] https://docs.wso2.com/display/DSS310/Adding+Input+Mappings#
> AddingInputMappings-Validators
> [2] https://docs.wso2.com/display/DSS310/Defining+a+Dynamic+SQL+Query
>
> On Sat, Apr 7, 2018 at 12:43 AM, Laslo Pastor  wrote:
>
>> Hi
>>
>> I have some question about optional parameters in DSS.
>> I saw according to documentation[1] that we can set default value to
>> parameter but I wandering is there any way to check null value for given
>> parameter aka Null validator?
>>
>> use case scenario :
>> Select top 5 * from Inventory where code = @param OR @param IsNULL
>>
>> so if Im passing the @param it will return one row if @param is null it
>> will return top 5 rows
>>
>>
>> [1] https://docs.wso2.com/display/DSS310/Adding+Input+Mappings
>>
>> --
>>
>>
>> *Laslo Pastor*Associate Director,
>> Solution Architecture, WSO2 Inc.
>>
>> M: US: +1 281 542 3173 <2815423173>
>> LinkedIn: https://www.linkedin.com/in/pastorlaslo/
>> Skype: lpastor74
>>
>
>
>
> --
> Best Regards..
>
> Chanika Geeganage
> +94773522586
> WSO2, Inc.; http://wso2.com
>
>


-- 
*Vanjikumaran Sivajothy*
Lead Solutions Engineer - *WSO2 Inc. *
Committer and PMC member - Apache Synapse.
*http://wso2.com *
 *+1-925-464-6816*
[image: Facebook]  [image: Twitter]
 [image: LinkedIn]
 [image:
Blogger]  [image: SlideShare]


This communication may contain privileged or other confidential information
and is intended exclusively for the addressee/s. If you are not the
intended recipient/s, or believe that you may have received this
communication in error, please reply to the sender indicating that fact and
delete the copy you received and in addition, you should not print,
copy, re-transmit, disseminate, or otherwise use the information contained
in this communication. Internet communications cannot be guaranteed to be
timely, secure, error or virus-free. The sender does not accept liability
for any errors or omissions
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Null value validator in DSS

2018-04-06 Thread Chanika Geeganage
+dev@wso2.org

Hi Laslo,

There are certain validators you can define for input parameter as listed
in [1]. There is no null validator as such, but you can write a custom
validator. This just validate the input parameter before executing the
query, but there is no way to change the result set.

For your usecase I would suggest to configure the query with a QUERY_STRING
parameter [2], where it allows you to pass a part of the query in the
runtime. For an example, the query would be,


  select * from Inventory :filterQuery
  
 
 ..
  
  
   

 Then at the run time you can pass either the were clause or 'LIMIT 5' to
filter out the top 5. If you pass an empty parameter it will retrieve all
the entries.

[1]
https://docs.wso2.com/display/DSS310/Adding+Input+Mappings#AddingInputMappings-Validators
[2] https://docs.wso2.com/display/DSS310/Defining+a+Dynamic+SQL+Query

On Sat, Apr 7, 2018 at 12:43 AM, Laslo Pastor  wrote:

> Hi
>
> I have some question about optional parameters in DSS.
> I saw according to documentation[1] that we can set default value to
> parameter but I wandering is there any way to check null value for given
> parameter aka Null validator?
>
> use case scenario :
> Select top 5 * from Inventory where code = @param OR @param IsNULL
>
> so if Im passing the @param it will return one row if @param is null it
> will return top 5 rows
>
>
> [1] https://docs.wso2.com/display/DSS310/Adding+Input+Mappings
>
> --
>
>
> *Laslo Pastor*Associate Director,
> Solution Architecture, WSO2 Inc.
>
> M: US: +1 281 542 3173 <2815423173>
> LinkedIn: https://www.linkedin.com/in/pastorlaslo/
> Skype: lpastor74
>



-- 
Best Regards..

Chanika Geeganage
+94773522586
WSO2, Inc.; http://wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev