You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Karts <ka...@gmail.com> on 2016/12/01 22:33:00 UTC

Simple IN with empty value in list

Hi,

I'm trying to use simple to test for an empty value in a list, so something
like:

simple("${body.stringValue} in ',gold,silver'")

It doesn't seem to work though, if body.stringValue is '' this fails.



--
View this message in context: http://camel.465427.n5.nabble.com/Simple-IN-with-empty-value-in-list-tp5790907.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Simple IN with empty value in list

Posted by Karts <ka...@gmail.com>.
In the end I just used .process() before the choice, got body.stringValue in
the Java code, tested and set an exchange header "isValid" to "true" if so,
and then subsequently tested for this in simple.

I didn't use something like .choice.when.simple("${body.stringValue.isEmpty}
|| ${body.stringValue} in 'gold,silver’")  as the simple block has multiple
&& and parentheses aren't supported yet for an || condition inside of there,
i.e. operator precedence. 



--
View this message in context: http://camel.465427.n5.nabble.com/Simple-IN-with-empty-value-in-list-tp5790907p5790937.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Simple IN with empty value in list

Posted by Karts <ka...@gmail.com>.
Thanks Claus, the double comma works well.



--
View this message in context: http://camel.465427.n5.nabble.com/Simple-IN-with-empty-value-in-list-tp5790907p5790960.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Simple IN with empty value in list

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah that would work, but I just checked you can get empty value if
you use double comma, eg

',,gold,silver'

On Fri, Dec 2, 2016 at 5:46 PM, Quinn Stevenson
<qu...@pronoia-solutions.com> wrote:
> Maybe something like this would work?
>
> .choice.when.simple("${body.stringValue.isEmpty} || ${body.stringValue} in 'gold,silver’")
>
>> On Dec 2, 2016, at 9:23 AM, Claus Ibsen <cl...@gmail.com> wrote:
>>
>> I dont think an empty value is supported
>>
>> On Fri, Dec 2, 2016 at 3:59 PM, Karts <ka...@gmail.com> wrote:
>>> Sorry, to be clear, body.stringValue could be "", "gold", "silver", "bronze",
>>> "platinum", etc.
>>>
>>> I am trying to test so that only "", "gold" or "silver" are allowed before
>>> moving forward, which is why I have the comma at the start, to allow for a
>>> blank (not null) value:
>>>
>>> .choice.when.simple("${body.stringValue} in ',gold,silver'")
>>>
>>> But I'm finding if body.stringValue="", it does not satisfy the condition.
>>> Is there another way I can do this?
>>>
>>> Thanks
>>>
>>>
>>>
>>> --
>>> View this message in context: http://camel.465427.n5.nabble.com/Simple-IN-with-empty-value-in-list-tp5790907p5790926.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Simple IN with empty value in list

Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
Maybe something like this would work?

.choice.when.simple("${body.stringValue.isEmpty} || ${body.stringValue} in 'gold,silver’")

> On Dec 2, 2016, at 9:23 AM, Claus Ibsen <cl...@gmail.com> wrote:
> 
> I dont think an empty value is supported
> 
> On Fri, Dec 2, 2016 at 3:59 PM, Karts <ka...@gmail.com> wrote:
>> Sorry, to be clear, body.stringValue could be "", "gold", "silver", "bronze",
>> "platinum", etc.
>> 
>> I am trying to test so that only "", "gold" or "silver" are allowed before
>> moving forward, which is why I have the comma at the start, to allow for a
>> blank (not null) value:
>> 
>> .choice.when.simple("${body.stringValue} in ',gold,silver'")
>> 
>> But I'm finding if body.stringValue="", it does not satisfy the condition.
>> Is there another way I can do this?
>> 
>> Thanks
>> 
>> 
>> 
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Simple-IN-with-empty-value-in-list-tp5790907p5790926.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


Re: Simple IN with empty value in list

Posted by Claus Ibsen <cl...@gmail.com>.
I dont think an empty value is supported

On Fri, Dec 2, 2016 at 3:59 PM, Karts <ka...@gmail.com> wrote:
> Sorry, to be clear, body.stringValue could be "", "gold", "silver", "bronze",
> "platinum", etc.
>
> I am trying to test so that only "", "gold" or "silver" are allowed before
> moving forward, which is why I have the comma at the start, to allow for a
> blank (not null) value:
>
> .choice.when.simple("${body.stringValue} in ',gold,silver'")
>
> But I'm finding if body.stringValue="", it does not satisfy the condition.
> Is there another way I can do this?
>
> Thanks
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Simple-IN-with-empty-value-in-list-tp5790907p5790926.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Simple IN with empty value in list

Posted by Karts <ka...@gmail.com>.
Sorry, to be clear, body.stringValue could be "", "gold", "silver", "bronze",
"platinum", etc.

I am trying to test so that only "", "gold" or "silver" are allowed before
moving forward, which is why I have the comma at the start, to allow for a
blank (not null) value:

.choice.when.simple("${body.stringValue} in ',gold,silver'")

But I'm finding if body.stringValue="", it does not satisfy the condition.
Is there another way I can do this?

Thanks



--
View this message in context: http://camel.465427.n5.nabble.com/Simple-IN-with-empty-value-in-list-tp5790907p5790926.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Simple IN with empty value in list

Posted by Claus Ibsen <cl...@gmail.com>.
You have a comma before gold. It should just be 'gold,silver'

On Thu, Dec 1, 2016 at 11:33 PM, Karts <ka...@gmail.com> wrote:
> Hi,
>
> I'm trying to use simple to test for an empty value in a list, so something
> like:
>
> simple("${body.stringValue} in ',gold,silver'")
>
> It doesn't seem to work though, if body.stringValue is '' this fails.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Simple-IN-with-empty-value-in-list-tp5790907.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Simple IN with empty value in list

Posted by souciance <so...@gmail.com>.
fails as in gives you an exception or fails as in not the behavior you
expected.

On Thu, Dec 1, 2016 at 11:33 PM, Karts [via Camel] <
ml-node+s465427n5790907h80@n5.nabble.com> wrote:

> Hi,
>
> I'm trying to use simple to test for an empty value in a list, so
> something like:
>
> simple("${body.stringValue} in ',gold,silver'")
>
> It doesn't seem to work though, if body.stringValue is '' this fails.
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Simple-IN-with-empty-
> value-in-list-tp5790907.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428h31@n5.nabble.com
> To unsubscribe from Camel - Users, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/Simple-IN-with-empty-value-in-list-tp5790907p5790908.html
Sent from the Camel - Users mailing list archive at Nabble.com.