Discussion:
[Freemarker-devel] Comparison Issue
MG 2016
2016-01-27 17:01:31 UTC
Permalink
Hi There,

I started using the Free Marker today.

<#if record.quantity?length == 2>

The above seems to be false. When I switch this to !=2 it seems to be OK. I
just want to show a bit of text when the quantity is 2

What I'm I doing incorrectly?



--
View this message in context: http://freemarker.624813.n4.nabble.com/Comparison-Issue-tp4655606.html
Sent from the freemarker-devel mailing list archive at Nabble.com.
Daniel Dekany
2016-01-27 19:46:49 UTC
Permalink
It should work like that, so the only thing I can think of is that the
length is indeed not 2.

BTW, this mailing list has been retired months ago. There's
***@freemarker.incubator.apache.org instead (see
http://freemarker.incubator.apache.org/mailing-lists.html). Where did
you find the old address?
--
Thanks,
Daniel Dekany
Post by MG 2016
Hi There,
I started using the Free Marker today.
<#if record.quantity?length == 2>
The above seems to be false. When I switch this to !=2 it seems to be OK. I
just want to show a bit of text when the quantity is 2
What I'm I doing incorrectly?
--
http://freemarker.624813.n4.nabble.com/Comparison-Issue-tp4655606.html
Sent from the freemarker-devel mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
FreeMarker-devel mailing list
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Lee
2016-01-27 20:51:14 UTC
Permalink
What kind of data type is record.quantity?

If record.quantity is a *list* (array), use <#if record.quantity*?size* ==
2> (
http://freemarker.incubator.apache.org/docs/ref_builtins_sequence.html#ref_builtin_size
)

If record.quantity is a *string*, use <#if record.quantity*?length* == 2>

If record.quantity is an *integer*, use <#if record.quantity == 2>
Post by Daniel Dekany
It should work like that, so the only thing I can think of is that the
length is indeed not 2.
BTW, this mailing list has been retired months ago. There's
http://freemarker.incubator.apache.org/mailing-lists.html). Where did
you find the old address?
--
Thanks,
Daniel Dekany
Post by MG 2016
Hi There,
I started using the Free Marker today.
<#if record.quantity?length == 2>
The above seems to be false. When I switch this to !=2 it seems to be
OK. I
Post by MG 2016
just want to show a bit of text when the quantity is 2
What I'm I doing incorrectly?
--
http://freemarker.624813.n4.nabble.com/Comparison-Issue-tp4655606.html
Sent from the freemarker-devel mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Post by MG 2016
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
FreeMarker-devel mailing list
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
FreeMarker-devel mailing list
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Daniel Dekany
2016-01-27 21:33:22 UTC
Permalink
That's good point, though ?length on a non-list(ish) value will give
an error instead of a non-2 value.
Post by Lee
What kind of data type is record.quantity?
If record.quantity is a list (array), use <#if record.quantity?size
== 2>
(http://freemarker.incubator.apache.org/docs/ref_builtins_sequence.html#ref_builtin_size)
If record.quantity is a string, use <#if record.quantity?length == 2>
If record.quantity is an integer, use <#if record.quantity == 2>
It should work like that, so the only thing I can think of is that the
length is indeed not 2.
BTW, this mailing list has been retired months ago. There's
http://freemarker.incubator.apache.org/mailing-lists.html). Where did
you find the old address?
--
Thanks,
Daniel Dekany
Post by MG 2016
Hi There,
I started using the Free Marker today.
<#if record.quantity?length == 2>
The above seems to be false. When I switch this to !=2 it seems to be OK. I
just want to show a bit of text when the quantity is 2
What I'm I doing incorrectly?
--
http://freemarker.624813.n4.nabble.com/Comparison-Issue-tp4655606.html
Sent from the freemarker-devel mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
FreeMarker-devel mailing list
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
FreeMarker-devel mailing list
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
--
Thanks,
Daniel Dekany
Daniel Dekany
2016-01-27 22:07:29 UTC
Permalink
Eh... I mean, ?size on a non-list(ish) value gives error. As of
?length, that gives error on non-string values, although if someone
uses pure BeansWrapper instead of DefaultObjectWrapper, listable
things can be also strings.
Post by Daniel Dekany
That's good point, though ?length on a non-list(ish) value will give
an error instead of a non-2 value.
Post by Lee
What kind of data type is record.quantity?
If record.quantity is a list (array), use <#if record.quantity?size
== 2>
(http://freemarker.incubator.apache.org/docs/ref_builtins_sequence.html#ref_builtin_size)
If record.quantity is a string, use <#if record.quantity?length == 2>
If record.quantity is an integer, use <#if record.quantity == 2>
It should work like that, so the only thing I can think of is that the
length is indeed not 2.
BTW, this mailing list has been retired months ago. There's
http://freemarker.incubator.apache.org/mailing-lists.html). Where did
you find the old address?
--
Thanks,
Daniel Dekany
Post by MG 2016
Hi There,
I started using the Free Marker today.
<#if record.quantity?length == 2>
The above seems to be false. When I switch this to !=2 it seems to be OK. I
just want to show a bit of text when the quantity is 2
What I'm I doing incorrectly?
--
http://freemarker.624813.n4.nabble.com/Comparison-Issue-tp4655606.html
Sent from the freemarker-devel mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
FreeMarker-devel mailing list
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
FreeMarker-devel mailing list
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
--
Thanks,
Daniel Dekany
MG 2016
2016-01-27 22:17:05 UTC
Permalink
Thanks for getting back.

I am still trying to work out the exact type of quantity. I assumed it was
an int because the out put on the form is always an int. I am trying to
generate a PDF within NetSuite ERP.

None of these seem to work for me. But I can see the text if I use !=

<#if record.quantity?size ==14>TEST</#if>
<#if record.quantity?length==14>TEST</#if>
<#if record.quantity ==14>TEST</#if>



--
View this message in context: http://freemarker.624813.n4.nabble.com/Comparison-Issue-tp4655606p4655611.html
Sent from the freemarker-devel mailing list archive at Nabble.com.
Daniel Dekany
2016-01-28 01:40:44 UTC
Permalink
If it's a number then you need "record.quantity == 14". The others
(?size an ?length) should give you an error, as number has no size or
length. Do they not? Something strange is going on there... do they
suppress FreeMarker errors and output nothing? If quantity is a string
that looks like a number, then you should also get an error (for
comparing a string to a number), but then you could use
"record.quantity?number == 14". (BTW, you can easily try these
scenarios on http://freemarker-online.kenshoo.com/)
Post by MG 2016
Thanks for getting back.
I am still trying to work out the exact type of quantity. I assumed it was
an int because the out put on the form is always an int. I am trying to
generate a PDF within NetSuite ERP.
None of these seem to work for me. But I can see the text if I use !=
<#if record.quantity?size ==14>TEST</#if>
<#if record.quantity?length==14>TEST</#if>
<#if record.quantity ==14>TEST</#if>
--
http://freemarker.624813.n4.nabble.com/Comparison-Issue-tp4655606p4655611.html
Sent from the freemarker-devel mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
FreeMarker-devel mailing list
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
--
Thanks,
Daniel Dekany
MG 2016
2016-02-03 16:14:19 UTC
Permalink
Hi Daniel,

I sorted the integer issue out but this one is driving me crazy! I can't
see to get two divs floating across each other and show text. This code
works fine in normal html pages but not using free marker! Any ideas? The
text Test is not displayed.

<?xml version="1.0" ?>
<!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
<pdf>
<head>
<style type="text/css">
#details {
background-color: lightblue;
width: 50%;
height: 100px;
}

#summary {
background-color: red;
width: 50%;
height: 100px;
}

</style>
</head>

<body>
<div id="details" style="float:left; display:inline"> <span>test</span>
</div>
<div id="summary" style="float:left; display:inline"> <span>test</span>
</div>
</body>
</pdf>

On Thu, Jan 28, 2016 at 1:18 AM, Daniel Dekany [via FreeMarker] <
Post by Daniel Dekany
If it's a number then you need "record.quantity == 14". The others
(?size an ?length) should give you an error, as number has no size or
length. Do they not? Something strange is going on there... do they
suppress FreeMarker errors and output nothing? If quantity is a string
that looks like a number, then you should also get an error (for
comparing a string to a number), but then you could use
"record.quantity?number == 14". (BTW, you can easily try these
scenarios on http://freemarker-online.kenshoo.com/)
Post by MG 2016
Thanks for getting back.
I am still trying to work out the exact type of quantity. I assumed it
was
Post by MG 2016
an int because the out put on the form is always an int. I am trying to
generate a PDF within NetSuite ERP.
None of these seem to work for me. But I can see the text if I use !=
<#if record.quantity?size ==14>TEST</#if>
<#if record.quantity?length==14>TEST</#if>
<#if record.quantity ==14>TEST</#if>
--
http://freemarker.624813.n4.nabble.com/Comparison-Issue-tp4655606p4655611.html
Post by MG 2016
Sent from the freemarker-devel mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Post by MG 2016
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
FreeMarker-devel mailing list
[hidden email] <http:///user/SendEmail.jtp?type=node&node=4655612&i=0>
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
--
Thanks,
Daniel Dekany
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
FreeMarker-devel mailing list
[hidden email] <http:///user/SendEmail.jtp?type=node&node=4655612&i=1>
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
------------------------------
If you reply to this email, your message will be added to the discussion
http://freemarker.624813.n4.nabble.com/Comparison-Issue-tp4655606p4655612.html
To unsubscribe from Comparison Issue, click here
<http://freemarker.624813.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4655606&code=ZGlsYWwubWlhaEBtb3ZlZ3VpZGVzLmNvbXw0NjU1NjA2fC0xOTM4MDY1OTI=>
.
NAML
<http://freemarker.624813.n4.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://freemarker.624813.n4.nabble.com/Comparison-Issue-tp4655606p4655615.html
Sent from the freemarker-devel mailing list archive at Nabble.com.
Daniel Dekany
2016-02-03 21:28:02 UTC
Permalink
It's the browser that does those things (interpreting HTML and CSS),
so it's not related to FreeMarker. The HTML that you generate with
FreeMarker must differ from the one that has worked in some relevant
way. If you generate the same HTML with FreeMarker, it will look
exactly the same.
Post by MG 2016
Hi Daniel,
I sorted the integer issue out but this one is driving me crazy! I
can't see to get two divs floating across each other and show text.
This code works fine in normal html pages but not using free marker!
Any ideas? The text Test is not displayed.
<?xml version="1.0" ?>
<!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
<pdf>
  <head>
    <style type="text/css">
 #details {
  background-color: lightblue;
  width: 50%;
  height: 100px;
 }
 Â
 #summary {
  background-color: red;
  width: 50%;
  height: 100px;
 }
</style>
</head>
<body>
 <div id="details" style="float:left; display:inline"> <span>test</span> </div>
 <div id="summary" style="float:left; display:inline"> <span>test</span> </div>
  </body>
</pdf>
If it's a number then you need "record.quantity == 14". The others
(?size an ?length) should give you an error, as number has no size or
length. Do they not? Something strange is going on there... do they
suppress FreeMarker errors and output nothing? If quantity is a string
that looks like a number, then you should also get an error (for
comparing a string to a number), but then you could use
"record.quantity?number == 14". (BTW, you can easily try these
scenarios on http://freemarker-online.kenshoo.com/)
Post by MG 2016
Thanks for getting back.
I am still trying to work out the exact type of quantity. I assumed it was
an int because the out put on the form is always an int. I am trying to
generate a PDF within NetSuite ERP.
None of these seem to work for me. But I can see the text if I use !=
<#if record.quantity?size ==14>TEST</#if>
<#if record.quantity?length==14>TEST</#if>
<#if record.quantity ==14>TEST</#if>
--
Thanks,
Daniel Dekany
Loading...