Unplugged currency converter - xpages

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.

Related

Excel cut a string between two characters

I would like to cut out all a specific strong from 4000+ rows in Excel - but preserve a value from the string that I cut out.
The original:
(#partname )
Which I would like to be the following:
partname
These links/hyperlinks/codes are not in all the cells, but in some of the cells its present more than once. And in others not present at all.
I´m using Excel 2007.
I have however also tested in Excel 2010 - and tried to use the automatic tool to wipe out hyperlinks - it didn't work.
HERE ONE OF THE CELL-INFO (From cell A1):
<h2>PPC-308 Bright indictor</h2>
<h3>Original part for PPC</h3> <h3>This part fits all these models:</h3>
Model 1<br />
Model 2<br />
Model 3<br />
Model 4<br />
Model 5<br />
Model 6<br />
<p>PPC Bright Indicator will give you instant information as to your vehicles status. Once installed, simply turn your CSM battery on and the indicator will show you the power level of your battery. The SDF level indicator should only be used with hump back battery packs.
Adding the PPC <strong>Battery Pack</strong> (#2012 ) to your Machine increases stability performance and time.<strong> TXX </strong>(#87022) is recommended to support the battery.</p>
<p>The Battery Level Indicator is designed for battery packs such as the #A222 Hump Installer Pack. Kit includes:
<ul> <li>IDICATOR</li>
<li>MAGASINE</li> <li>COVER PLATE</li></ul>
This solution will need to be adjusted depending on the formatting with multiple hyperlinks. With one or none, this is fine.
I would insert two columns to the right of column with the hyperlink.
In the first column, I would insert a function =Right(Insert cell reference A1,13).
In the second column, I would insert the following functions =IF(Insert cell reference A1=Insert your hyperlink text,Left(Insert cell reference B1,9),"partname")
I would then copy and paste special values over the original and delete the two columns.

Adding individual float values per UITableViewCell to get grand totals?

I am having a major problem even getting started with finding an answer to this question? I have a UITableView that is being populated by user generated content and being persisted to CoreData. All is good. However I can't even find a way in the Apple docs to do the following:
How do I add each dollar value in a cell to get a grand total displayed somewhere to the user? In this case it can be thrown in a UILabel in the footer of each section I don't care. What I can't figure out is how to get to each individual cell get the dollar amount entered there and add it to the next dollar amount in the next cell in the section and so on.
Any ideas on how to add totals from cells to get a grand total?
The most elegant solution to this problem is using key paths.
You do not go to the cells and get the data out. You go to your data model and calculate it from there. Remember, MVC dictates that you should always separate model and view.
Suppose you have a subclass of NSManagedObject with an NSNumber attribute "amount" fetched via core data. You can then easily do simple calculations like this:
float sum = [[fetchedObjects valueForKeyPath:#"#sum.amount"] floatValue];
This is described in the Key-Value Coding Programming Guide under Collection Operators.

how to get currency sign to display in a view panel xpages

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.

RowSpan and colspan table attributes in Repeat control

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

How to handle localized numeric values in Xpage?

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.

Resources