I want to bind a value and format it with a localized string. Something like that :
<TextBlock Text="{Binding Age, StringFormat='\{0\} {Binding Path=LocalizedResources.Global_AgeSuffix, Source={StaticResource LocalizedStrings}}'}" />
Output :
30 ans if french culture
30 years if other culture
Is it possible ?
Regards,
Flo
Unfortunately you can't format bound text this way on Windows Phone.
There are two alternatives.
Add another property to the bound object which has the formatting already applied
Apply the formatting with a converter.
Related
I have an array of objects which i am displaying as a line graph in kendo.
The category axis is a date and is data between a large period of time. I want to display this date neatly (In the UK/ Rest of world date format). However i cannot seem to get this to work. Here is my HTML code below
<kendo-chart [transitions]="true">
<kendo-chart-axis-defaults [majorGridLines]="{ visible : false}">
</kendo-chart-axis-defaults>
<kendo-chart-category-axis>
<kendo-chart-category-axis-item>
<kendo-chart-category-axis-item-labels culture="en-GB"
format="d"
step="50">
</kendo-chart-category-axis-item-labels>
</kendo-chart-category-axis-item>
</kendo-chart-category-axis>
<kendo-chart-value-axis>
<kendo-chart-value-axis-item>
<kendo-chart-value-axis-item-labels culture="en-GB"
format="c">
</kendo-chart-value-axis-item-labels>
</kendo-chart-value-axis-item>
</kendo-chart-value-axis>
<kendo-chart-series>
<kendo-chart-series-item type="line" [data]="items | async"
field="cumulativePercentReturn"
markers="markers"
dashType="solid"
categoryField="startDate">
</kendo-chart-series-item>
</kendo-chart-series>
</kendo-chart>
The dates, however, are still rendered as yyyy-mm-dd etc.
The kendo for angular 2 guide is not very specific here, asking me to refer to a globalisation article which does not exist on the site.
If anyone could aid me in getting this working. I have tried editing that format string in every way i can sensibly think of.
So i solved this!
It turned out the JSON data returned was showing the date formatted as a string. The date formatting worked when i cast this string back to a date.
I am currently using the Advanced Find in CRM 2011, and I can't seem to find a way to filter a Date field that is before a certain date. The closest operator that I could find was "on-or-before", but I need it to be before that date and not on it.
I use lt (less than) if I need to do it by time. Presumably you can use gt too.
<condition attribute='scheduledstart' operator='lt' value='2015-03-16 10:29' />
I have a Xpage with three fields, all Number declared; Nominal, Price and PaymentAmount.
I want to calculate the PaymentAmount using Nominal * Price.
In SSJS onChange I use the following code:
var price = getComponent("Price").getValue();
to get the value from the field "Price".
In Sweden we enter our numeric values as this #.###,## 1.234,56
If I enter the values Nominal=10 and Price=2,5 in my Xpage and try to calculate using the above mentioned formula the value stored in var "price" is converted to 25 and of type long.
Please advice
/M
I'm an idiot, unfortunatly.
Did this:
<inputText value="#{document1.Price}" id="Price" required="true" size="10">
<this.validators>
<validateRequired message="Price is required">
</validateRequired>
</this.validators>
<this.converter>
<convertNumber type="number" locale="sv">
</convertNumber>**
</this.converter>
</inputText>
and it works!
Thanks you ALL for input
I take it "Price" is an edit box? If so you can set it to Number field, then Display format to currency. The currency code will define how that number is displayed.
When you get the components value it should come back as a normal number you can work with.
getComponent gets the UI component value and that's why it does not necessarily reflect the data type that will be saved (in UI everything is string). It's also a slow way to get the value.
Try datasourcename.getItemValueDouble("itemname") instead. Note that you need to use the field name on Form, not the component name.
Regarding number format make sure your djConfig locale is Sweden, probably se-se. For me in Finland it looks like this:
<script type="text/javascript" src="/xsp/.ibmxspres/dojoroot-1.6.1/dojo/dojo.js" djConfig="locale: 'fi-fi', parseOnLoad: true"></script>
It should use the browser locale. To force this in SSJS you can do:
context.setLocaleString("se-SE");
in beforePageLoad event.
There is a default value for the length of the displayed suggestion from rich:autocomplete tag. I can't find which attribute controls this value.
popupClass and inputClass define the style of the input box and poup box respectively.
But it doesn't affect the length of the text displayed.
Does anyone know how I can change the length of text displayed ?
Use minChars attribute for controlling the minimum number of characters to be entered for auto complete to start working.
<rich:autocomplete minChars="2" />
And as far as max characters is considered, when a User starts entering a very long text and doesn't find what he is searching for in the suggestion box, you think User will still continue typing them?
I made an excel report, which contains some Double type TextFields with number format pattern ##0.#
In OpenOffice, these cells are formatted correctly (Which is exactly what I need)
1.56 -> 1.6
0.0 -> 0
However, when I opened report with Microsoft Excel, the decimal point did not disappear like I excpected.
1.56 -> 1.6
0.0 -> 0.
After some search, I found a post about number format in Excel.
In Excel format number with optional decimal places
I tried [=0]0;.# instead as the post suggested. But Excel complain about about my cell number format are broken.
My question is : What pattern should I use in JasperReport, so Excel won't show the trailing decimal point ?
UPDATE : I just find out the pattern described in link dose not solve all cases, it match only 0, not 1.0, 2.0... etc.
You can try to use net.sf.jasperreports.export.xls.formula property.
The sample:
<textField pattern="##0.#">
<reportElement x="0" y="0" width="100" height="20">
<property name="net.sf.jasperreports.export.xls.formula" value="[=0]0;##0,#"/>
</reportElement>
<textElement/>
<textFieldExpression><![CDATA[$F{sum}]]></textFieldExpression>
</textField>
In my case the comma (,) is delimiter in my OS.
The information about net.sf.jasperreports.export.xls.formula property you can find here.
As workaround you may paste in field this code:
new DecimalFormat("0.##").format($F{bigdecValue})
So, processing for xls will be without comma if thera are trailinig zeros.