I have a column in an xpage that I want to display the currency symbol with the value. In the underlying Notes View it is displaying. I have tried both the view panel and the dynamic view but neither display the $ symbol. It just displays the number. Also if it is an integer number ($100.00) it just displays 100. I want it to display trailing zeros after decimal place along with the currency symbol
In view control you can set the view column's "Display Type" to "Number" and then "Display format" to "Currency". This would enable you to set the Currency symbol of your choice and format it accordingly. So your view column's code would look something like this:
<xp:viewColumn columnName="price" id="viewColumn4">
<xp:this.converter>
<xp:convertNumber currencySymbol="$" minFractionDigits="2" type="currency"></xp:convertNumber>
</xp:this.converter>
<xp:viewColumnHeader value="Price" id="viewColumnHeader4"></xp:viewColumnHeader>
</xp:viewColumn>
In above example price is stored as number.
Related
Suppose I have the following Excel pivot table:
The definition of the pivot table from pivotTable1.xml contains the following relevant snippets:
<location ref="I8:M26" firstHeaderRow="1" firstDataRow="2" firstDataCol="1" rowPageCount="1" colPageCount="1"/>
<dataFields count="1">
<dataField name="Custom Sum of Amount" fld="3" baseField="1" baseItem="0"/>
</dataFields>
Given these pieces of data, together with the rest of the definition, is it possible to accurately determine the cell (I8) where the "Custom Sum of Amount" is placed? Unfortunately I couldn't find something helpful in the SpreadsheetML specification and I don't want to rely on unbacked assumptions about its location.
Also, it would very helpful for me if I could also determine the cell location for the other auto-generated captions, such as "Custom Row Labels Caption", "Custom Column Labels Caption" and "Custom Grand Total Caption".
Work out the Values field that you want the info for, then use:
pf.LabelRange.Address
I'm using the Unplugged Mobile Controls and have a customised version of the UnpFlatView.
Inside the repeat control, which is bound to a view, I'm trying to display a column value from the view formatted as a currency field, with the following code :-
<xp:text escape="true" id="computedField3">
<xp:this.value><![CDATA[#{javascript:thisRowData.getColumnValue("Cost");}]]></xp:this.value>
<xp:this.converter>
<xp:convertNumber
type="currency">
</xp:convertNumber>
</xp:this.converter>
</xp:text>
The value is displayed - but without the currency symbol.
I have also tried removing the converter and changing the format of the column in the view to currency format - but again just get the numeric value.
Any ideas how I can get a formatted currency value to display?
Following a conversation with Mark Dixon from Teamstudio, this is due to an issue in the current version of Unplugged (3.1.1). Unplugged needs to clone the component subtree for every row in a repeat control. The converter is not being included in the clone and, hence, the value is not being converted to a currency format.
This will be resolved in the next maintenance release of Unplugged.
I have table placed inside repeat control and I need to construct the <xp:td> tag with rowspan and colspan attributes, where the attribute value changes dynamically. I am not able to find a solution, could you suggest me the best possible solution. Here is my scenario -
Basically I need to show a table quarterly wise where the row span changes, based on selection of start date and end date. for e.g.
Start Date : 1-Feb-2013 and End Date : 30-Dec-2013
-
In "All Properties" of a <xp:td> you find rowspan and colspan. Both attributes can be computed. I suggest you compute that in a function you call with some parameter th be handed over. You might need a requestScope or viewScope object to keep track of your row/col span usage. use JSON for it, makes things easier.
Hth
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.
When I create a content type for SharePoint in XML in Visual Studio. Is it possible to create a field with the Type "Number" and give it a custom format? I don't want the thousands separator, but for some reasons I can't use the type "Integer" ...
EDIT: I tried this without success ...
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Element (0x01) -->
<ContentType ID="0xMyId"
Name="MyType"
Group="MyGroup"
Description="..."
Inherits="TRUE"
Version="0">
<FieldRefs>
<FieldRef ID="{5231bb5f-37c8-4ca8-b256-58337cfe82d3}" Name="Right_ID" DisplayName="Right ID" Required="TRUE" />
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Required="TRUE" />
</FieldRefs>
</ContentType>
<Field ID="{5231bb5f-37c8-4ca8-b256-58337cfe82d3}"
Type="Number"
Commas="FALSE"
Decimals="0"
Name="Right_ID"
Group="My Group"
DisplayName="Right ID"
StaticName="Right_ID"
Hidden="FALSE"
Required="TRUE"
Sealed="FALSE" />
</Elements>
Maybe I should add, that the target system has german culture, so the thousands separator is . (dot) not , (comma).
If you are creating a custom field, you should be able to set Commas to FALSE in the Field Element. But that attribute is not listed as supported in the FieldRef Element of a Content Type.
EDIT:
I'm beginning to wonder if Commas does not work on Number regardless of locale.
From MSDN (emphasis mine):
Integer Allows for positive or
negative integer values. The Commas
and NegativeFormat attributes are used
to specify integer formatting.
Corresponds to the int SQL data type.
and
Number Allows for a floating point
number to be entered. This field is
sortable and groupable. Numbers
entered are parsed according to the
current locale settings for decimal
points and thousand separators.
Negative numbers can be indicated by
wrapping them in parentheses or by
using a negative symbol. The following attributes can be used in conjunction with the Number attribute to specify number formatting: Decimals, Div, Max, Min, Mult, and Percentage.
With this, to remove the thousands separator I would either:
Try Integer again
Create a Calculated field based on the Number field that removes the comma by converting to text.