Paul,

In terms of NiFi EL, the "literal" function takes its argument, evaluates
it if there's an expression as the argument, and returns it as a literal
within the expression in which it is being used.  In other words, it's
creating a literal in the code itself.

On Wed, Aug 24, 2016 at 11:01 AM Paul Nahay <[email protected]> wrote:

> https://en.wikipedia.org/wiki/Literal_%28computer_programming%29
>
> >A) The "literal" function's purpose allows the user to evaluate an
> argument that is a literal itself,
>
> Yes
>
> >B) or another expression
>
> That's not a LITERAL, although it is a VALUE. You're confusing "literal
> value" (for which "literal" is a shorthand way of saying the same thing)
> with "value".
>
> As the Wikipedia article explains, a literal is a value coded into the
> code itself. That is NOT the same thing as a value produced by the process
> of EVALUATION, which is what your phrase in "B" above is. So while I
> understand you guys can call anything you want any way you want, your use
> of "literal" is inconsistent with its general universal understanding in
> programming languages, and thus, was very confusing to me when I
> encountered it in your code response to me.
>
>
> Paul
>
>
> -----Original Message-----
> From: Jeff
> Sent: Aug 24, 2016 10:43 AM
> To: Paul Nahay , "[email protected]"
> Subject: Re: Can't Chain "count()" with "plus()"
>
> Paul,
>
> We'll have to agree to disagree. :)  The "literal" function's purpose
> allows the user to evaluate an argument that is a literal itself, or
> another expression, as a literal value, and allow functions to be chained
> on the result.  It's aptly named, in my opinion.
>
> NiFi EL does have a "toString" function, but it's not subjectless.
>  "literal" could be renamed "string", perhaps, but it would introduce
> confusion with the current "toString" function.
>
> On Wed, Aug 24, 2016 at 2:18 AM Paul Nahay <[email protected]> wrote:
>
>> Thanks.
>>
>> BTW:
>>
>> literal
>>
>> *Description*: Returns its argument as a literal String value. This is
>> useful in order to treat a string or a number at the beginning of an
>> Expression as an actual value, rather than treating it as an attribute
>> name. Additionally, it can be used when the argument is an embedded
>> Expression that we would then like to evaluate additional functions against.
>>
>> *Subject Type*: No Subject
>>
>> *Arguments*:
>>
>>    -
>>
>>    *value* : The value to be treated as a literal string, number, or
>>    boolean value.
>>
>>
>> Your function "literal" really should be named "value", since that is
>> what it does: it interprets its argument as a value, rather than as an
>> attribute name. A literal in a program is a literal value like 2 or "two".
>> Or, it should be called "string", if that's what it really produces, even
>> in the case of the argument being a number. But "literal" is definitely the
>> wrong name for it.
>>
>> Paul
>>
>>
>> -----Original Message-----
>> From: Jeff
>> Sent: Aug 23, 2016 2:52 PM
>> To: Paul Nahay , "[email protected]"
>> Subject: Re: Can't Chain "count()" with "plus()"
>>
>> Paul,
>>
>> I refer you to the documentation for count[1], which states: "Aggregate
>> function that counts the number of non-null, non-false values returned"
>>
>> [1]
>> https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#count
>>
>>
>> On Tue, Aug 23, 2016 at 2:37 PM Paul Nahay <[email protected]> wrote:
>>
>>> Thanks.
>>>
>>> However, your documentation is lacking, because in your documentation
>>> for "allDelineatedValues", there is nothing that explains how ":count()"
>>> can be applied to:
>>> *Return Type*: Boolean
>>> meaning, how ":count()" can be applied to each boolean separately to
>>> produce a "4".
>>>
>>> Yes, I understand what it's doing, but your documentation doesn't
>>> explain what it needs to. If this is true:
>>>
>>> *Return Type*: Boolean
>>>
>>> then your table with examples with "Value" in the right-hand column
>>> should have only booleans, not the integer 4 in it.
>>>
>>> Paul
>>>
>>> -----Original Message-----
>>> From: Jeff
>>> Sent: Aug 23, 2016 1:00 PM
>>> To: Paul Nahay , "[email protected]"
>>> Subject: Re: Can't Chain "count()" with "plus()"
>>>
>>> Hello Paul,
>>>
>>> The documentation for allDelineatedValues[1] states that each of the
>>> resulting values are evaluated against the rest of the Expression.  You
>>> need to use an embedded expression, since you don't want the plus function
>>> to be evaluated against each split from allDelineatedValues.  Try this
>>> slightly more complex expression:
>>>
>>> ${literal(${allDelineatedValues("aaa,bbb,ccc",","):count()}):plus(1)}
>>>
>>> [1]
>>> https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#alldelineatedvalues
>>>
>>> On Tue, Aug 23, 2016 at 12:21 PM Paul Nahay <[email protected]> wrote:
>>>
>>>> The following NiFi Expression Language construct gives me an error, and
>>>> I don't understand why:
>>>>
>>>> ${allDelineatedValues("aaa,bbb,ccc",","):count():plus(1)}
>>>>
>>>> It's fine without the ":plus(1)", but fails with it, with this error:
>>>>
>>>> AttributeExpressionLanguageException:
>>>> Cannot evaluate Expression because it attempts to reference multiple
>>>> attributes but does not use a reducing function
>>>>
>>>> (I am typing the error message above)
>>>>
>>>> It would seem like I should be able to add 1 to a count.
>>>>
>>>> It's NiFi version 0.6.1.c
>>>>
>>>>
>>>> Paul Nahay
>>>> 1013 Rosemere Ave.
>>>> Silver Spring, MD 20904-3008
>>>> 301-680-3825 (home)
>>>> 301-806-9265 (cell)
>>>> [email protected]
>>>>
>>>
>>> Paul Nahay
>>> 1013 Rosemere Ave.
>>> Silver Spring, MD 20904-3008
>>> 301-680-3825 (home)
>>> 301-806-9265 (cell)[email protected]
>>>
>>>
>>>
>>>
>> Paul Nahay
>> 1013 Rosemere Ave.
>> Silver Spring, MD 20904-3008
>> 301-680-3825 (home)
>> 301-806-9265 (cell)[email protected]
>>
>>
>>
>>
>> Paul Nahay
>> 1013 Rosemere Ave.
>> Silver Spring, MD 20904-3008
>> 301-680-3825 (home)
>> 301-806-9265 (cell)[email protected]
>>
>>
>>
>>
> Paul Nahay
> 1013 Rosemere Ave.
> Silver Spring, MD 20904-3008
> 301-680-3825 (home)
> 301-806-9265 (cell)[email protected]
>
>
>
>

Reply via email to