How to format numeric result in a datatable?

I have a View Object (not tied to an Entity Object) that is displaying a read-only table that includes numeric values.
I'm not able to figure out how to control the display formatting so that only 1 decimal place is shown - right now the numbers are showing more than 10 decimal places.
Is there anyway to control the display format for numerics using either the View Object Editor Properties, or, through using attributes of the <af:outputText> tag on the .jspx page?
Here is what I have defined currently:
In the View Object Editor, the numeric columns are defined as:
View Attribute Tab: Type=Big Decimal
Control Hints Tab: Format Type=Number; Format = ####.## (question does this formatting only apply when editing the field, or also should it apply when I'm reading/displaying from the database?)
In .jspx page:
<af:column headerText="#{bindings.ZipCodeTestView1.labels.Latitude}"
sortProperty="Latitude" sortable="true">
<af:outputText value="#{row.Latitude}"/>
</af:column>
thanks
Tom

hmmm.. I had tried that. What I'm noticing now is that if I test the VO in the BC4J tester within Jdev the format mask is applied. However, when I add the table (as readonly) to a .jspx page and deploy to Tomcat, the format mask is not used when I view the page in Firefox 1.5.0.3 (or Internet Explorer 6.0)? Any ideas?
here's a snippet for one of the columns from the .jspx page:
<af:column headerText="#{bindings.ZipCodeTestView1.labels.Latitude}"
sortProperty="Latitude" sortable="true">
<af:outputText value="#{row.Latitude}"/>
</af:column>
Message was edited by:
javaX

Similar Messages

  • How to get numeric result from 'search and replace' string function

    hii
    i am using search and replace function to get output.my output is of form ' *X0123.3 ' .here i am replacing the term *X01 with space because i need only 23.3 as a result.but i am unable to get that out in the output indicator.i used lot of functions like string to number and so on but i am getting output as zero .can you please suggest me wt to do.i am attaching a copy of my file.
    Attachments:
    Untitled 1.vi ‏25 KB

    Your problem is the fact that you are converting it to an integer, thus loosing the fractional part. You need to use "Fract/Exp String To Number" instead and create a DBL so yor data is 23.3 instead of 23.
    You also don't need to manipulate the string if the initial part is of constant lenght. Just use the offset input as in the figure below.
    Message Edited by altenbach on 07-31-2006 07:02 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ToDBL.png ‏2 KB

  • How can I format the results?

    hi,
    I do this caculation
    double cal = 1.0/3.0;
    I just want the result like this "0.3333". How can I format this result?
    Thanks,
    Bin

    java.text.DecimalFormat xForm = new java.text.DecimalFormat("#, ##0.00");:)

  • How to export the result to excel or txt as the SQL result format.

    Hello,
    I want to know how to export the result of the Oracle select result to a txt or a excel file.What is the command.
    I knew the command of spool,but the format of it export is not the same to the result of Oracle result area.
    Thank you very much.

    Hello Yucky,
    what do you mean by
    the format of it export is not the same to the result of Oracle result areaDo you mean the output of a tool other than SQL*PLUS?
    To enhance the formatting of a spool file you can set
    SET MARKUP HTML ON
    SPOOL ONthis will add html markup to format the output as a html table which you can open in a browser or in excel.
    Regards
    Marcus

  • How to Format DataTable Column after load Datatable without extra loop ??

    How to Format Column after load Datatable without extra loop ??
    I dont want to do extra logic which can cause performance thing.
    I have datatable which get fill from Dataset after database query, now i need to format column as decimal but without extra logic.
    I was thinking to create clone and than Import row loop but it ll kill performance, its WPF application.
    Thanks
    Jumpingboy

    You cannot do any custom things at all without doing some "extra logic". Formatting a number as decimal is certainly not a performance killer in any way whatsoever though.
    If you are displaying the contents of the DataTable in a DataGrid you could specify a StringFormat in the XAML:
    <DataGrid x:Name="dg1" AutoGenerateColumns="False">
    <DataGrid.Columns>
    <DataGridTextColumn Header="Number" Binding="{Binding num, StringFormat=N2}"/>
    </DataGrid.Columns>
    </DataGrid>
    Or if you are using auto-generated columns you could handle the AutoGeneratingColumn event:
    public MainWindow() {
    InitializeComponent();
    DataTable table1 = new DataTable();
    table1.Columns.Add(new DataColumn("num")
    DataType = typeof(decimal)
    table1.Rows.Add(1.444444444444);
    table1.Rows.Add(7.444444444444);
    dg1.ItemsSource = table1.DefaultView;
    dg1.AutoGeneratingColumn += dg1_AutoGeneratingColumn;
    void dg1_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e) {
    if (e.PropertyName == "num") {
    DataGridTextColumn column = e.Column as DataGridTextColumn;
    column.Binding.StringFormat = "N2";
    <DataGrid x:Name="dg1" />
     Please remember to mark helpful posts as answer and/or helpful.

  • How to FORMAT a number field in Formula editor

    Dear All,
    I have a "QUANTITY" field in database which has to get displayed in the report as " QTY : " that  will look like QTY : 54.
    Where as now it coming as QTY : 54.00
    So, how to format this field in the Formula Editor while concatenation of
    "QTY : " + CStr()
    If any one has any idea please help me out.
    Thanks and regards.

    Hi friends,
    Thanks to all of you that you all have replied my question and given your answers.
    Thanks to all of you specially Alpana Phapale, Wallie Chang, Poonam Thorat and Raghavendra Gadhamsetty, the answers given by you is the perfect one may be in different ways and only one can be used by me. But your answers were exactly correct.
    Thanks to Asha Lund, your answers is also correct but the result as per my report should be in figures and not in words.
    Whatever it may be but for repling thanks to you too.
    Please be always with me, I am very new to Crystal Report and just learnt by my own as my Boss ordered me to do this and I have to make about 50 reports within 15 days. I think the day will start from today.
    Well friends thanks a lot again for all your effort.

  • How to access the Result of an fileReference request ?

    Hello,
    I have adjusted this example ( http://cookbooks.adobe.com/post_Uploading_files_from_Flex_using_PHP-5241.html ) of uploading an Image to an Server.
    But the Problem i have is that i wanted to return from the php file some informations for example if the image is really uploaded.
    Does someone know how to read the result that comes in an xml format in actionscript ?
    PHP file:
    $tempFile = $_FILES['file']['tmp_name'];
    $fileName = $_FILES['file']['name'];
    $fileSize = $_FILES['file']['size'];
    $upload = move_uploaded_file($tempFile, "./" . $fileName);
    if(!$upload) {
    echo "<failure>"."upload failed"."</failure>";
    Thank you,
    Zombiecook

    Hi,
      if you schedule the job then you can create the spool..
      But if you want to create a spool while executing in foreground...
      Then use this code..before calling the ALV FM..
      DATA: DAYS(1)  TYPE N VALUE 2,
          COUNT(3) TYPE N VALUE 1,
          VALID    TYPE C.
    DATA: PARAMS LIKE PRI_PARAMS.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING DESTINATION           = 'LOCL'
                COPIES                = COUNT
                LIST_NAME             = 'TEST'
                LIST_TEXT             = 'First NEW-PAGE PRINT ON'
                RELEASE               = 'X'
                IMMEDIATELY           = ' '
                NEW_LIST_ID           = 'X'
                EXPIRATION            = DAYS
                LINE_SIZE             = 79
                LINE_COUNT            = 23
                LAYOUT                = 'X_PAPER'
                SAP_COVER_PAGE        = 'X'
                RECEIVER              = 'SAP*'
                DEPARTMENT            = 'System'
                NO_DIALOG             = ' '
      IMPORTING OUT_PARAMETERS        = PARAMS
                VALID                 = VALID.
    IF VALID <> SPACE.
      NEW-PAGE PRINT ON PARAMETERS PARAMS NO DIALOG.
      WRITE / 'First Spool'.
    ENDIF.
    Thanks,
    Naren

  • How to init numeric display

    In my vi i have a numeric display and a button. when button is pressed, some arithmetic calculation will happen (takes abt two seconds) and then result shown on the numeric display. if the result is less than a certain value the text bg will be red, otherwise grey.
    I have no problem writing the above vi.
    But what i don't know how is, before the result is calculated (before the two seconds is up), i want the numeric display to show empty and green color. how can i do this? overtime the button is pressed, the display should be cleared and grey, until the calculation is done.
    Solved!
    Go to Solution.

    Numeric indicators are always going to show some value.  The default value is zero.
    But if you want to make it appear to be blank, you could make the font color the same as the background color.  Then when the time is up, programmatically set the font color back to the original color to make it visible.

  • How To Format Sysdate

    How do you format sysdate? I want the results to be in date format, but I only want the date itself without the time added as
    6/14/2010
    The To_Date function doesn't seem to work as it converts a string to a date and sysdate isn't a string?
    Thanks for any help..

    user12296489 wrote:
    Turns out that I can specify to change the format from text to date when I import the data into access. So, after using To_Char to save the data in mm/dd/yy text format, I can import that, changing it to date format upon the import..That sounds like the correct thing to do.
    You have to remember, when you talk about "format", you are talking about how something is displayed or output and that means you are talking about strings. Only character based datatypes are strings (VARCHAR2, CLOB) and the other datatypes are internal representations that have to be formatted to strings to be displayed.
    For examples, if I look at the string 'FRED'...
    SQL> select 'FRED', dump('FRED') as dmp from dual;
    'FRE DMP
    FRED Typ=96 Len=4: 70,82,69,68You can see that it's stored internally as 4 bytes each of which are the ascii values of the 4 characters in the string. There's no formatting needed as it's already a direct representation of the ASCII characters needed to display it.
    However, if I look at sysdate...
    SQL> select sysdate, dump(sysdate) as dmp from dual;
    SYSDATE             DMP
    15/06/2010 08:28:04 Typ=13 Len=8: 218,7,6,15,8,28,4,0Whilst it displayes in DD/MM/YYYY HH24:MI:SS format, the internal storage of it is something completely different. It's made up of 8 bytes of data that sort of (but not fully) represent the number parts of the date, but contain non of the formatting that would display it as it appeared to me.
    The format for the date comes from my local session settings, which tell it how to format it as a string. I can change this...
    SQL> alter session set nls_date_format='DD-MON-YYYY';
    Session altered.
    SQL> select sysdate, dump(sysdate) as dmp from dual;
    SYSDATE     DMP
    15-JUN-2010 Typ=13 Len=8: 218,7,6,15,8,32,44,0Now the date is displayed differently, but internally it's still represented by 8 bytes, that hasn't changed.
    So, if you want to format dates, or numbers, you need to use the TO_CHAR function and specify the format it should be displayed in. You can use the NLS settings, but they are session specific and you would need to be careful using them. It's always better to be explicit about the format you want using TO_CHAR instead.

  • How to format paragraph string to show content left, Right or middle of pdf document using iTextsharp ' vb

    Dear All
    how to format paragraph string to show content left, Right or middle of pdf document using iTextsharp in visual basic and absolute position on the document.
    Thanks

     Here is one more example that i have modified the GetCell function so that you can use it for adding all the cells to the document.  It takes several arguments to specify everything you need to create each cell.  It now lets
    you specify the Text, the Text Alignment, the Text Font and color, weather the cell shows the Border, the BackColor of the cell, and the Padding values for the Left, Right, Top, and Bottom.
     If you study the code you should be able to figure out how it works.  From here you can figure out the rest of what you need to do and how to use the
    GetCell function.
     With one quick google search for "iTextSharp Documentation" the first link to pop up was this link.
    iTextSharp Documentation
    Imports System.IO
    Imports Its = iTextSharp.text
    Public Class Form1
    Private dt As New DataTable
    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    dt.Dispose()
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    dt.Columns.Add("Name")
    dt.Columns.Add("Age")
    dt.Columns.Add("Birth Date")
    dt.Rows.Add(New Object() {"Johnny", "23", Now.AddYears(-23).ToString})
    dt.Rows.Add(New Object() {"Frank", "41", Now.AddYears(-41).ToString})
    dt.Rows.Add(New Object() {"Rex", "33", Now.AddYears(-33).ToString})
    dt.Rows.Add(New Object() {"Kim", "26", Now.AddYears(-26).ToString})
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim MyPdfFilePath As String = "C:\TestFolder\MyPdf.pdf"
    Dim pSize As New Its.Rectangle(Its.PageSize.A4)
    Dim PdfDoc As Its.Document = New Its.Document(pSize, 10, 10, 10, 10)
    Dim PdfImage As New Its.Jpeg(New Uri("C:\TestFolder\MyLogo.jpg"))
    PdfImage.Alignment = Its.Jpeg.ALIGN_CENTER
    Dim pTable As New Its.pdf.PdfPTable(1)
    pTable.AddCell(getCell("Name : " & TextBox1.Text, Its.pdf.PdfPCell.ALIGN_CENTER, Its.FontFactory.GetFont("Arial", 15, Its.BaseColor.BLACK), False, Its.BaseColor.WHITE, 10, 0, 0, 0))
    pTable.AddCell(getCell("Policy : " & TextBox2.Text, Its.pdf.PdfPCell.ALIGN_CENTER, Its.FontFactory.GetFont("Arial", 20, Its.BaseColor.RED), False, Its.BaseColor.WHITE, 10, 20, 0, 0))
    Dim cTable As New Its.pdf.PdfPTable(dt.Columns.Count)
    For Each col As DataColumn In dt.Columns
    cTable.AddCell(getCell(col.ColumnName, Its.pdf.PdfPCell.ALIGN_CENTER, Its.FontFactory.GetFont("Arial", 12, Its.BaseColor.WHITE), True, Its.BaseColor.BLUE, 3, 5, 0, 0))
    Next
    Dim tblfont As Its.Font = Its.FontFactory.GetFont("Arial", 10, Its.BaseColor.BLACK)
    For Each row As DataRow In dt.Rows
    cTable.AddCell(getCell(row.Field(Of String)("Name"), Its.pdf.PdfPCell.ALIGN_LEFT, tblfont, True, Its.BaseColor.WHITE, 3, 4, 3, 0))
    cTable.AddCell(getCell(row.Field(Of String)("Age"), Its.pdf.PdfPCell.ALIGN_CENTER, tblfont, True, Its.BaseColor.WHITE, 3, 4, 0, 0))
    cTable.AddCell(getCell(row.Field(Of String)("Birth Date"), Its.pdf.PdfPCell.ALIGN_RIGHT, tblfont, True, Its.BaseColor.WHITE, 3, 4, 0, 3))
    Next
    Using fs As New FileStream(MyPdfFilePath, FileMode.Create, FileAccess.Write, FileShare.None)
    Using pdfWrite As Its.pdf.PdfWriter = Its.pdf.PdfWriter.GetInstance(PdfDoc, fs)
    PdfDoc.Open()
    PdfDoc.Add(PdfImage)
    PdfDoc.Add(pTable)
    PdfDoc.Add(cTable)
    PdfDoc.Close()
    End Using
    End Using
    PdfDoc.Dispose()
    End Sub
    ''' <summary>Creates a new cell for the table.</summary>
    ''' <param name="text">The text string for the cell.</param>
    ''' <param name="alignment">Alighnment for the text string.</param>
    ''' <param name="textfont">The font used for the text string.</param>
    ''' <param name="border">True to show the cell border. False to hide the cell border.</param>
    ''' <param name="backcolor">The background color of the cell.</param>
    ''' <param name="padtop">The amount of padding on the top of the text string.</param>
    ''' <param name="padbottom">The amount of padding on the bottom of the text string.</param>
    ''' <param name="padleft">The amount of padding on the left of the text string.</param>
    ''' <param name="padright">The amount of padding on the right of the text string.</param>
    Public Function getCell(ByVal text As String, ByVal alignment As Integer, ByVal textfont As Its.Font, ByVal border As Boolean, ByVal backcolor As Its.BaseColor, ByVal padtop As Single, ByVal padbottom As Single, ByVal padleft As Single, ByVal padright As Single) As Its.pdf.PdfPCell
    Dim cell As New Its.pdf.PdfPCell(New Its.Phrase(text, textfont))
    cell.BackgroundColor = backcolor
    cell.PaddingLeft = padleft
    cell.PaddingRight = padright
    cell.PaddingTop = padtop
    cell.PaddingBottom = padbottom
    cell.HorizontalAlignment = alignment
    If Not border Then cell.Border = Its.pdf.PdfPCell.NO_BORDER
    Return cell
    End Function
    End Class
    If you say it can`t be done then i`ll try it

  • How do link form input and a datatable that are on the same page?

    I am real new to JSF, so I'm having the following issue...
    I created a demo app that will pull records from from a database and display them in a datatable. I hava a backingbean for this process that works great with hardcoded data.
    Now, I want to add a form to this page and use the form input to drive the results in the datatable. I have created my form and used a separate backingbean that is essentially a JavaBean for all the form input.
    My question is how do I integrate the submit button from this new form to feed the call that is used for the datatable?
    Here's is a snippet of the pertinent code from the JSP:
    <TABLE border="0">
                   <TBODY>
                        <TR>
                             <TD>
                             <P>Correlation ID:</P>
                             </TD>
                             <TD><h:inputText styleClass="inputText" id="correlationId"
                                  value="#{LogMessageBean.correlationId}"></h:inputText></TD>
                             <TD width="121"></TD>
                             <TD width="153">
                             <P>Workflow ID:</P>
                             </TD>
                             <TD width="158"><h:inputText styleClass="inputText" id="workItemId"
                                  value="#{LogMessageBean.workItemId}"></h:inputText></TD>
                        </TR>
                   </TBODY>
              </TABLE>
              <BR>
              <div align="center">
              <h:commandButton value="Search" actionListener="#{LogValueListHandler.search}" action="#{LogValueListHandler.result}"/>
              <h:commandButton value="Reset" onclick="reset()"/></div>
              <H5>Application Logging Results</H5>
              <t:dataTable value="#{LogValueListHandler.logList}" var="feed"
                   rowClasses="oddrow, evenrow" headerClass="table">
                   <t:column>
                        <f:facet name="header">
                             <h:outputText value="ClassName" />
                        </f:facet>
                        <h:outputText value="#{feed.className}" />
                   </t:column>
                   <t:column>
                        <f:facet name="header">
                             <h:outputText value="MethodName" />
                        </f:facet>
                        <h:outputText value="#{feed.methodName}" />
                   </t:column>
    ...Thanks!

    Locutus_1,
    I'm working on the same sort of app - A data table where the record selected is displayed in a form below the datatable and may be edited and saved.
    I've included a checkbox in the datatable so that the user can indicate which record is to be displayed and edited. The have everything working, except that I cannot get the checkbox click event passed to the backing bean correctly (critical to the entire operation). When I have this working, I'll post the code.
    This solution does not have a direct link between the datatable model and the data handled by the form. The backing bean code does this. If there was a solution where the two could be linked directly via JSF, I'd be very interested in it.
    Werner

  • Conditional formating in result table

    i am working on Endeca 3.1 version
    How to do conditional formating in  result table for string metric?
    is there any way available to achieve this?

    I have a different status value . Like Cancel,work in progress, Revision etc...
    Have to highlight the each status in different colors.
    is there any way available?

  • How to save query result in excel file

    Hi all,
    How to save query result in excel file from sql*plus tool.
    thank you

    Do you really need an Excel file (binary) or a simple CSV?
    If you just need a CSV then search for DUMP_CSV at http://asktom.oracle.com or at this forum
    If you need formatting and/or multiple worksheets then you can use free tools like
    https://xml-spreadsheet.samplecode.oracle.com/ or https://exceldocumenttype.samplecode.oracle.com/
    Regards
    Marcus

  • How to obtain aggregate results using ODBC?

    How do I obtain results of an aggreate functions like SUM etc? I have an MFC application that uses CRecordset. Following is the code snip:
    CDatabase db1;
    o1 db; // class that is a sub class of CRecordset and makes a connection to the Oracle
    // database
    try
    BOOL bUseCursorLib = FALSE;
    db1.Open(_T( "globaldb" ), FALSE, FALSE, _T( "ODBC;UID=scott;PWD=tiger" ),FALSE);
    catch(CDBException* e)
    TRACE0(e->m_strError + "\n");
    AfxMessageBox("Error... "+e->m_strError);          
    e->Delete();
    if( db1.IsOpen() )
    db1.Close();     
    CString strCmd = "select sum(ordernumber) from orders";
    try
    db1.ExecuteSQL( strCmd );
    catch(CDBException *e)
    AfxMessageBox("Error here: "+e->m_strError);
    CString t;
    t.Format("Sum=%ld",db.m_sum_ORDERNUMBER);
    AfxMessageBox(t);
    I always get zero displayed as the sum. I am going wrong somewhere for sure. I am not able to figure out.

    This ought to work. Can you verify that you have the latest ODBC driver and that you have the proper version of the MDAC installed?
    Justin

  • CallableStatement,  how to get function result ?

    Hello all,
    I know that this issue more relevant to JDBC, but it seems that their forum is more "sleepy" than that one therefor i trying my luck here with you...
    I've a pl/sql function which get 2 int arguments, and return float result
    I use CallableStatement in order to execute pl/sql function.
    with CallableStatement.setInt i transfer argument to the function,
    but i dont know how to "catch" function result (as i said earlier, function results is float)
    any help here...
    Thanks
    Edited by: igalep132 on Nov 21, 2009 4:47 AM

    igalep132 wrote:
    If you do have a PL/SQL function (specific syntax in PL/SQL) then you use the following form from the javadocs.
    {?= call <procedure-name>[(<arg1>,<arg2>, ...)]}
    [http://java.sun.com/javase/6/docs/api/java/sql/CallableStatement.html]
    that's exactly what i did, but my teacher assistant told me that it's wrong, because CallableStatement uses for stored Procedures, but I have here a function (because it returns a value...) therefor i need to use PrepareStatment/Statement...Third person accounts are always hard to judge, but what you are claiming is wrong (whether the TA said it or not.)
    First a prepared statement can in fact be used to run either a proc or function. So can statement for that matter.
    However callable statement is provided as a convenience to run procs and functions.
    There can however be reasons why a driver doesn't allow that - I have used a driver that didn't support callable statements at all (procs or functions.)
    That said the the format I gave you is specifically modeled for functions.

Maybe you are looking for

  • I'm in deep trouble and tears with 10.6.5, Pse help

    Have a big job to finish on my iMac, my primary machine. Was running just fine on 10.6.4 but installed 10.6.5 downloaded off the normal software update, so I can update my iPad when OS4.2 comes out. The installation appeared to go fine. Machine resta

  • Friends need help desperate-- Second page not printing from the beginning

    Hi Friends, I have a large layout whose main-section is 8.5x20 (Width&height) which has 2 frames each having 2 repeating frames and about 20 fields in each repeating frame. When I run the report it shows the report right, but when I print, it prints

  • Updated Camera Raw CS4 Plugin (no plugin folder??)

    I am trying to install the updated SC4 Camera Raw Plugin but I can't find the Plugin folder referred to in the following directions: 5. Navigate to:(Please read directory carefully) Library/Application Support/Adobe/Plug-Ins/CS4/File Formats 6. Copy

  • What did Firefox do with my bookmarks?

    I have Windows 8. It said I was running out of space so deleted some apps i never use. Now when firefox comes up, its just a blank page. If i try to list or show bookmarks it is blank. I did the restore and it did get bookmarks back but now when I sh

  • UJBR transaction data restore shows no data

    Dear All, We did a transaction data backup on the PROD to restore in QA. The UJBR restoration of transaction data on QA shows as successful both in foreground and background modes. However, no data is seen on the models. When i checked the zipped fil