nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Witt <joe.w...@gmail.com>
Subject Re: String conversion to Int, float double
Date Fri, 25 Mar 2016 15:58:26 GMT
Ok and can you share the config settings you have in Attributes to
JSON  at this time?  We do need to make changes for this probably but
want to understand what will be a good path forward.

On Fri, Mar 25, 2016 at 9:49 AM, Madhukar Thota
<madhukar.thota@gmail.com> wrote:
> Hi Joe,
>
> In my UpdateAtrribute, i am converting the  string values to Number like
> this:
>
> rt_firstbyte ${http.param.t_resp:toNumber()}
> rt_lastbyte  ${http.param.t_page:toNumber()}
> rt_loadtime  ${http.param.t_done:toNumber()}
>
> when i pass this attribute to AttributeToJson processor, the type should be
> properly serialized but here is what i am getting from  AttributeToJson
> processor
>
> {"rt_loadtime":"260","rt_firstbyte":"20","referrer":"http://localhost:63342/Beacon/test.html","rt_lastbyte":"240"}
>
> This what i expect
>
> {"rt_loadtime":260,"rt_firstbyte":20,"referrer":"http://localhost:63342/Beacon/test.html","rt_lastbyte":240}
>
> Thanks
>
> On Fri, Mar 25, 2016 at 10:47 AM, Joe Witt <joe.witt@gmail.com> wrote:
>>
>> Chase,
>>
>> To unsubscribe send an e-mail here users-unsubscribe@nifi.apache.org
>>
>> Madhukar,
>>
>> As Bryan mentioned attributes are always serialized as Strings.  Their
>> type is really a function of when they are being evaluated/used.  Can
>> you describe a bit more about what you'd like AttributesToJson to do
>> with a given attribute that is of type Int/Long/etc..?
>>
>> Thanks
>> Joe
>>
>>
>>
>> On Fri, Mar 25, 2016 at 8:01 AM, Chase Cunningham <chase@thecynja.com>
>> wrote:
>> > unsubscribe
>> >
>> >
>> > On 3/25/16 9:01 AM, Madhukar Thota wrote:
>> >
>> > Any Other ways to achieve this?
>> >
>> > On Thu, Mar 24, 2016 at 4:48 PM, Bryan Bende <bbende@gmail.com> wrote:
>> >>
>> >> I think the problem is that all attributes are actually Strings
>> >> internally, even after calling toNumber() that is only temporary while
>> >> the
>> >> expression language is executing.
>> >>
>> >> So by the time it gets to AttributesToJson it doesn't have any
>> >> information
>> >> about the type of each attribute and they all end up as Strings. I
>> >> think we
>> >> would have to come up with a way to pass some type information along to
>> >> AttributesToJson in order to get something other than Strings.
>> >>
>> >> -Bryan
>> >>
>> >>
>> >> On Thu, Mar 24, 2016 at 3:30 PM, Madhukar Thota
>> >> <madhukar.thota@gmail.com>
>> >> wrote:
>> >>>
>> >>> Hi i am trying to convert string value to integer in UpdateAtrributes
>> >>> using toNumber like this
>> >>>
>> >>>
>> >>> ${http.param.t_resp:toNumber()}  where http.param.t_resp = "132"
>> >>>
>> >>> but when the fileattribute pushed to Attributetojson processor , i am
>> >>> stilling seeing it as string. Am i am doing something wrong? and also
>> >>> how
>> >>> can i convert string to float?
>> >>>
>> >>>
>> >>>
>> >>>
>> >>
>> >
>> >
>> > --
>> > Dr. Chase C Cunningham
>> > CTRC (SW) USN Ret.
>> > The Cynja LLC Proprietary Business and Technical Information
>> > CONFIDENTIAL TREATMENT REQUIRED
>
>

Mime
View raw message