9 Replies Latest reply on Nov 3, 2009 9:23 PM by user5500620

    Right align number field

    user5500620
      I am trying to right align some numerical fields in a results table. I have tried both numbers and strings and can't get the numbers to align to the right. I have even written a method to handle the alignment and nothing works.
        • 1. Re: Right align number field
          PrazzyJay
          do this thing

          bean.setCurrencyCode("USD");

          this will automatically right align your field.


          --Prasanna                                                                                                                                                                                                                               
          1 person found this helpful
          • 2. Re: Right align number field
            Reetesh Sharma
            You can use CSS class also to align, please check if it helps.

            Regards,
            Reetesh Sharma
            • 3. Re: Right align number field
              713492
              hi,
              r u using advanced table region for getting results.

              then you can use the following aligmment types for columns

              number--"numberFormat" alignment

              Strings---use "textFormat" alignment
              • 4. Re: Right align number field
                368540
                in my results table i did the following

                in the controller class add:

                on top
                import oracle.apps.fnd.framework.webui.beans.table.OATableBean;
                import oracle.cabo.ui.data.DataObjectList;

                within the existing class
                public void processRequest(OAPageContext pageContext, OAWebBean webBean)
                +{+
                super.processRequest(pageContext, webBean);

                OATableBean tableBean =
                (OATableBean)webBean.findIndexedChildRecursive("*MyResultsTable*");

                tableBean.prepareForRendering (pageContext);

                DataObjectList myColumnFormats = tableBean.getColumnFormats();

                // for field 1
                oracle.cabo.ui.data.DictionaryData myFieldColumnFormat =
                (oracle.cabo.ui.data.DictionaryData)myColumnFormats.getItem(pageContext.findChildIndex(tableBean, "*MyField*"));
                // just do something with the field now ...
                myFieldColumnFormat.put (CELL_NO_WRAP_FORMAT_KEY, Boolean.TRUE);

                After doing that, the number field "My Field" is shown right aligned.

                Please change MyResultsTable and MyField like you see it in your object navigator.

                If you need it for more than just one field, please copy the section "// for field 1" accordingly.

                Hope this helps
                Regards
                Volker
                • 5. Re: Right align number field
                  user5500620
                  Thank you so much. That worked!

                  Now what would I have to add or modify to get that right aligned field to display in a currency format?

                  Example: $10,000,000.00
                  • 6. Re: Right align number field
                    368540
                    Hi,

                    I am not sure if the currency char is according to the EBS OAF standards.

                    To set the number format I used:

                    String formatter = "USD";
                    OAMessageStyledTextBean regUSDAmtBean=(OAMessageStyledTextBean)webBean.findIndexedChildRecursive("*MyNumberField*");
                    if (regUSDAmtBean != null)
                    { regUSDAmtBean.setAttributeValue(CURRENCY_CODE,formatter); }

                    Place this right below ther other code.

                    There are possibilities to use "setAttributeValue" to set any custom format, but I havn't used yet, sorry.

                    see Re: Currency Formatting in OAF

                    Regards
                    Volker

                    Edited by: veckardt on Nov 3, 2009 8:39 AM
                    1 person found this helpful
                    • 7. Re: Right align number field
                      user5500620
                      Thanks that worked.

                      I changed it up a bit because I needed the dollar sign also.

                      import oracle.cabo.ui.validate.Formatter;
                      import oracle.apps.fnd.framework.webui.OADecimalValidater;

                      Formatter formatter2 = new OADecimalValidater("$#,##0.00;($#,##0.00)","$#,##0.00;($#,##0.00)");
                      regUSDAmtBean.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, formatter2);


                      I've been trying to figure this out for days now. I really appreciate you taking the time to assist me.
                      • 8. Re: Right align number field
                        368540
                        Hi,

                        It's always my pleasure to support you. My solution is related to R11.5.10. Perhaps in R12 the framework and commands are a little bit different.

                        I assume you are in R11 too, right?

                        Best Regards
                        Volker
                        • 9. Re: Right align number field
                          user5500620
                          Yes, I am using R11.5

                          I do have another question regarding alignment.

                          But this time, aligning the header(title) for each column of the result table. I would like to center the column titles or prompts.

                          Is it possible to center them when using a regular OA table?