You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Paul <pa...@gmail.com> on 2012/03/19 21:19:41 UTC

Minilang Long to String conversion

Hi All, 

I have been batting to save a Long value to another field type="String" .
See the syntax below. 

<set field="quoteId" value="${someEntity.lastSeqId}"/>

someEntity.lastSeqId is of type Long and gets saved in entity of field type
numeric. So we know it is long and gets saved without trouble. 

Now the problem : 
For a someEntity.lastSeqId value of say 1000010  the value assigned to
quoteId becomes 1,00,010  i.e comma separated. Unable to figure out how to
get rid of this string formatting. Any suggestions? I just need to have the
same number as string without the comma separator. 

Thanks in advance
Ray


--
View this message in context: http://ofbiz.135035.n4.nabble.com/Minilang-Long-to-String-conversion-tp4486235p4486235.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Minilang Long to String conversion

Posted by Prince Sewani <pr...@ymail.com>.
Well I agree to what Ankush's said you could have said 


<set field="quoteId" from-field="someEntity.lastSeqId" type="Long"/>

That also can solve it the 'Minilang' Way ,  also in cases when you're dealing with custom object types,
you can call your specific java code and ask it to convert and return the appropriate type.

Regards
Prince



________________________________
 From: Paul <pa...@gmail.com>
To: user@ofbiz.apache.org 
Sent: Tuesday, March 20, 2012 1:49 PM
Subject: Re: Minilang   Long to String conversion
 
Wonderful. That fixed it. Thanks a lot. Also thanks for sharing the link .
Had missed it and see that it was got boat load of info. 

Ray

--
View this message in context: http://ofbiz.135035.n4.nabble.com/Minilang-Long-to-String-conversion-tp4486235p4487998.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Minilang Long to String conversion

Posted by ad...@sandglass-software.com.
By the way, I am working on a mini-language grammar overhaul that I  
hope will clear up some of these odd quirks in the language.

-Adrian

Quoting Paul <pa...@gmail.com>:

> Wonderful. That fixed it. Thanks a lot. Also thanks for sharing the link .
> Had missed it and see that it was got boat load of info.
>
> Ray
>
> --
> View this message in context:  
> http://ofbiz.135035.n4.nabble.com/Minilang-Long-to-String-conversion-tp4486235p4487998.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>




Re: Minilang Long to String conversion

Posted by Paul <pa...@gmail.com>.
Wonderful. That fixed it. Thanks a lot. Also thanks for sharing the link .
Had missed it and see that it was got boat load of info. 

Ray

--
View this message in context: http://ofbiz.135035.n4.nabble.com/Minilang-Long-to-String-conversion-tp4486235p4487998.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Minilang Long to String conversion

Posted by Nicolas Malin <ma...@librenberry.net>.
Look this : 
https://cwiki.apache.org/confluence/display/OFBTECH/Unified+Expression+Language+%28JSR-245%29+in+OFBiz

You can try :

<set field="quoteId" value="${str:toString(someEntity.lastSeqId)}"/>

Nicolas

Le 20/03/2012 08:23, Paul a écrit :
> Oops! Forgot to mention what I had already tried. Well that didn't work nor
> using a map-processor. Even tried inline groovy to see if that make a
> difference. No luck.
>
> Ray
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Minilang-Long-to-String-conversion-tp4486235p4487905.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.


-- 
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
-------
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/


Re: Minilang Long to String conversion

Posted by Paul <pa...@gmail.com>.
I'm not really sure how come that type='Long' won't work , I myself have
implemented and made use of that 


Well using Long as type of course won't put in the comma. However, the whole
point was to convert to String without the comma. So guess what you saw is
right, but that is different from what I was trying to do Long to String and
not Long to Long. The solution suggested by Nicolas worked, guess because it
bypassed the default formatting by converting to string directly or at least
that is what I got out of it so far. 

Ray


--
View this message in context: http://ofbiz.135035.n4.nabble.com/Minilang-Long-to-String-conversion-tp4486235p4492914.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Minilang Long to String conversion

Posted by Prince Sewani <pr...@ymail.com>.
I'm not really sure how come that type='Long' won't work , I myself have implemented and made use of that 

attribute several times, about the Map processor, even I don't like that one.

Regards
Prince



________________________________
 From: Jacques Le Roux <ja...@les7arts.com>
To: user@ofbiz.apache.org 
Sent: Tuesday, March 20, 2012 8:10 PM
Subject: Re: Minilang   Long to String conversion
 
This is where not quoting in Nabble shows
I guess Prince Sewani (who answered since) did not see your answer because he only uses a mail client...

Jacques

From: "Paul" <pa...@gmail.com>
> Oops! Forgot to mention what I had already tried. Well that didn't work nor
> using a map-processor. Even tried inline groovy to see if that make a
> difference. No luck. 
> Ray
> 
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Minilang-Long-to-String-conversion-tp4486235p4487905.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Minilang Long to String conversion

Posted by Jacques Le Roux <ja...@les7arts.com>.
This is where not quoting in Nabble shows
I guess Prince Sewani (who answered since) did not see your answer because he only uses a mail client...

Jacques

From: "Paul" <pa...@gmail.com>
> Oops! Forgot to mention what I had already tried. Well that didn't work nor
> using a map-processor. Even tried inline groovy to see if that make a
> difference. No luck. 
> 
> Ray
> 
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Minilang-Long-to-String-conversion-tp4486235p4487905.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Minilang Long to String conversion

Posted by Paul <pa...@gmail.com>.
Oops! Forgot to mention what I had already tried. Well that didn't work nor
using a map-processor. Even tried inline groovy to see if that make a
difference. No luck. 

Ray

--
View this message in context: http://ofbiz.135035.n4.nabble.com/Minilang-Long-to-String-conversion-tp4486235p4487905.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Minilang Long to String conversion

Posted by Ankush Upadhyay <an...@hotwaxmedia.com>.
Hello ,
For this case, i think you can use type attribute.

On 03/20/2012 01:49 AM, Paul wrote:
> Hi All,
>
> I have been batting to save a Long value to another field type="String" .
> See the syntax below.
>
> <set field="quoteId" value="${someEntity.lastSeqId}"/>
>
> someEntity.lastSeqId is of type Long and gets saved in entity of field type
> numeric. So we know it is long and gets saved without trouble.
>
> Now the problem :
> For a someEntity.lastSeqId value of say 1000010  the value assigned to
> quoteId becomes 1,00,010  i.e comma separated. Unable to figure out how to
> get rid of this string formatting. Any suggestions? I just need to have the
> same number as string without the comma separator.
>
> Thanks in advance
> Ray
>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Minilang-Long-to-String-conversion-tp4486235p4486235.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.

-- 
Thanks&  Regards
Ankush Upadhyay
ankush.upadhyay@hotwaxmedia.com