Numeric Format Masks on Text Items
Hello all.
I've been struggling to find the best way to use format masks for numbers on text items.
So far, I've found that the property "Format Mask" on the SOURCE group does not work. Am I correct?
I am trying to use To_Char to format the number, but I always get "NUmeric or Value Error".
In short, what is the easiest and most widely used way to format numbers (my language is pt-br). Ex.: 12500.00 becomes 12.500,00.
Thanks
Peter's solution shows you the syntax for to_char to get what you want; just replace the hard-coded number in his example with the value (or the expression giving the value) you're trying to format. So, something along the lines of:
select to_char(t.value, 'FM999G999D00', 'NLS_NUMERIC_CHARACTERS='',.''') val,
to_char(t.factor, 'FM999G999D00', 'NLS_NUMERIC_CHARACTERS='',.''') fct,
to_char(t.value * t.factor / 100, 'FM999G999D00', 'NLS_NUMERIC_CHARACTERS='',.''') rslt
from table t
where...Or, in a slightly more readable manner (I don't like having to constantly escape quote marks):
select to_char(t.value, 'FM999G999D00', q'{NLS_NUMERIC_CHARACTERS=',.'}') val,
to_char(t.factor, 'FM999G999D00', q'{NLS_NUMERIC_CHARACTERS=',.'}') fct,
to_char(t.value * t.factor / 100, 'FM999G999D00', q'{NLS_NUMERIC_CHARACTERS=',.'}') rslt
from table t
where...-David
Similar Messages
-
Number format mask of text item is not applied
Hello all,
I want to format a number like 999G999G999G999G990D00
Is specify the format mask under source of the item. But it is not applied and I don't understand why.
See http://apex.oracle.com/pls/otn/f?p=53873:2 for example
Btw. is it possible to set the format for all numbers in the application at once? I want to have a thousand separator in most cases.
Message was edited by:
Jacob_BHello Jacob,
Btw. is it possible to set the format for all numbers
in the application at once? I want to have a thousand
separator in most cases.I am using substitution strings for things like that. You can define some "global" substitution strings on page application definition.
So you just have to put in the format (999G999G999G999G990D00 ) in there once and give it a name. Let's say NUMBER_THOUSAND.
Afterwards you can reference it wherever you need the format e.g. this way:
to_char(10000,'&NUMBER_THOUSAND.').
This way you just have one place where to change the format model.
Regards,
Tine -
Date Format Mask with text only...
Hi!
I have a problem with my date text item: the format mask is set to YYYY-MM-DD HH24:MI:SS and it work perfectly if the user enter only numeric character, it will validate the date correctly. But if the user enter a value only alpha (something like 'uuuuyyyy') instead of validate with the mask format it will fire an error trigger ORA-06502.
I want to know if it's possible to check if the user has enter only alpha to bypass this problem.
Also, how can a check that a date field is null. I Try with : IF :BLOCK_NAME.DATE_ITEM IS NULL THEN ...
AND ALSO with IF TO_CHAR(:BLOCK_NAME.DATE_ITEM) IS NULL THEN... and nothings seems to work.
Thanx in advance.AFAIK, the only way to do this is to have two items. One is a hidden database item, type DATETIME, to hold the date value.
The other is a non-database character item, visible to the user. You populate it at POST-QUERY from the database field, and use an ON-VALIDATE-ITEM to copy any value entered/changed by the user over to the hidden field. If you're smart, you'll write a library procedure to do the on-validate stuff, passing it the names of the two items.
In that procedure, you can attempt to convert the entered text into a valid date using whatever date format(s) you like, only raising an error if you can't do it at all. -
Date Format Mask On Unbound Item
Hello everyone!
I have a module with some unbound items. One of them is date_completed. I gave the item datatype DATE and formatmask "DD-MM-RRRR". But in the application, when I type 290108, I get FRM-50026 "date must be entered like : DD-MM-YYYY.
But I gave the item a format mask!
Can somebody help me?But I gave the item a format mask!Then enter it in the format mask and not as a number
It is doing exactly what you are telling it to do
Nicolette -
Hi
Where does a simple text item pick up it's style from? (if you use the H1 etc. for example).
I am using 9.02
Thanks
DaveItems get their style from the page or the region, if the region has been configured to use a different style. The portal-supplied styles do not define the standard browser styles (H1, strong, etc.), so you are most likely seeing the browser default if you use these styles in text items.
If you want to define your own style sheets, you can do so in an Unstructured UI Template.
Regards,
Jerry
PortalPM -
Mass Formatting for Repetative Text Items
Recently I was working on an InDesign document that had a Atlas section higlighting each state on a seperate page. Each page had the same headers and this was repeated throughout the document. So in the case of this particular document the 8 headers on each page were repeated 50 times throughout the document. As I was applying styles to each of these headers I thought to myself, man it would be nice if you could define a set of conditions to InDesign character styles. Kind of like setting an email app to auto-sort certain messages if they contain a phrase or word."
For example you could create a condition that says:
If text after hard return reads "Quality Improvement Process" apply style "Subhead Style 2"
If you wanted "Subhead Style 2" to be applied to several different paragraph headers you could simply add a new condition. Then it would be just a matter of going through the document to make sure that condition didn't get accidentally applied where it shouldn't have. What is a 3 to 4 hour formatting job could become a half hour process.
Thoughts anyone?Actually, I may have misinterpreted the question.
First, if the same information is repeated in the same place on many pages, it belongs on the master page. Type once - appears many, andy you only need to edit one place. Variables are valuable for making running heads on a master page as you use the variable tag, and it can pick up the correct text from the page.
If you need to style this text in order to work with variables (or for any other reason) you can use find/change to do it. Search for the text in question, replace it with itself, and in the change formatting options apply the style.
Peter -
hi dear
possible to used format mask in list item DATE. i want that date will appear only 2007. possible this 'YYYY'
but i tried to put in intial values but dont work error. i put $$YYYY$$.. anyone knows?There is no Format Mask for list items in the property palette. But you can enter years by clicking on Elements in List. Then type in each year (e.g., 2007) in both the List Element and List Element Value.
Also look in the property palette for Initial Value and enter the desired year.
If you don't want to hardcode the year(s), then you can populate the list item dynamically at runtime using built-ins. See "Manipulating List Items at Runtime" in the Help documentation for examples. -
Hi,
How can we display a column value as a % in a report?
Thanks,
MachaanUnlike date/time and simple numeric format masks, there isn't a built-in mask for percentages. I usually just have to adjust my query to have it calculate the percentage and concatenate a ' %' at the end.
Example:
select ROUND(A/B*100,2) || ' %' as PCT
from MY_TABLE
where ...The difficulty is that sorting then becomes string like, so 102% will show up right after 10%...
If it is just an item, you can put the % in the AFTER CELL HTML. -
Using a datepicker with format mask MM/YYYY gives error on submit
I'm trying to use a datepicker with the format MM/YYYY.
The item is linked to a database column of type DATE.
The items displays correctly (month and year), but when submitting the page, I get an "ORA-01843: not a valid month" error from the built-in DML process.
Shouldn't Apex apply the same date format mask to the item value when trying to save it to the database?
- Morten
http://ora-00001.blogspot.comHi Mike,
I can/need to do that for my own PL/SQL processes, but the problem is with the Built-In DML Process....
- Morten
http://ora-00001.blogspot.com -
APEX cannot accept any other number format mask except 999G999G999G999G990?
Hi, guys:
Can anyone help me on this problem? I have a report with a column of number type, but I want to use accounting format mask such as <1234.56>, however. whenever I choose any other format model for this number column, I got the error message as "ORA-01481: invalid number format model", I can only choose Numeric format mask: 999G999G999G999G990
Anyone could give me a hint on this? I am using APEX 4.1 and Oracle 11G R2. Here is my query for report
select uh.descr, inv6.userkey, inv6.invno, inv6.amt-pa_temp.Subtotal_Payment over_short_amount
from
(select pa6.invoicekey, sum(pa6.amt) Subtotal_Payment
from payments pa6
where trunc(pa6.pmtdate)<=to_date(:P55_DP_VPF_PROD_DATE,'DD-MON-YY')
and pa6.type not in (5)
and pa6.invoicekey in (select pa5.invoicekey
from payments pa5
where trunc(pa5.pmtdate)=to_date(:P55_DP_VPF_PROD_DATE,'DD-MON-YY')
and pa5.type=2
group by pa6.invoicekey) pa_temp, invoices inv6, userhdr uh
where inv6.userkey=uh.userkey
and pa_temp.invoicekey=inv6.invoicekey
and pa_temp.Subtotal_Payment<>inv6.amt
and abs(inv6.amt-pa_temp.Subtotal_Payment)>1000
order by 1Thanks a lot!
SamI found the cause. Thanks!
-
Hi,
Good Evening,
How to set the format mask to text fields based on currencies.Hi Anil,
i am taking one method for setting the format mask to front end values
like this
public String xxformatmask(String test,String currency,OAPageContext pageContext)
String currencyFormattedNumber="";
try {
java.lang.Double num = new java.lang.Double(test);
currencyFormattedNumber = pageContext.getOANLSServices().formatCurrency(num,currency);
catch(Exception e) {
System.out.println("the exception is"+e);
return currencyFormattedNumber;
every time call this method
for text fields like this,
OAMessageTextInputBean commval=(OAMessageTextInputBean)webBean.findChildRecursive("commval");
String lesscomm=commval.getValue(pageContext).toString();
String lesscommformat=xxformatmask(lesscomm,currency,pageContext);
float lesscomm1=Float.parseFloat(lesscommformat);
i got the error at runtimeee
oracle.apps.fnd.framework.OAException: java.lang.NumberFormatException: For input string: "1,000.00"
at oracle.apps.fnd.framework.OAException.wrapperException(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at OA.jspService(_OA.java:71)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
## Detail 0 ##
java.lang.NumberFormatException: For input string: "1,000.00"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1224)
at java.lang.Float.parseFloat(Float.java:394)
at crm.oracle.apps.xxcrm.crmmgmt.quotationmgmt.server.xxcrmQuotationMgmtAMImpl.forserviceformvalsetting(xxcrmQuotationMgmtAMImpl.java:1994)
at crm.oracle.apps.xxcrm.crmmgmt.quotationmgmt.webui.xxcrmServiceCostSheetCO.processFormRequest(xxcrmServiceCostSheetCO.java:345)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at OA.jspService(_OA.java:71)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595) -
Problem with Format Masks and Computations
(I did a quick search on this, but didn't notice another thread on the topic. If there is already one I apologize.)
We are using APEX version 2.2.1.00.04.
I had an editable item that had the 999G990D00 format mask. In a computation I used that item and another item (that didn't have a format mask) to calculate a third item. The item I was trying to compute would not populate. It really had me stumped, so I went so far as to completely delete the fields and re-construct everything. When I did so the computation worked. That is until I put the format mask on the item again. I removed the format mask and the computation now works.
Is this a known issue? Is it a bug? Am I doing something wrong?
Thanks, TonyTony,
As Patrick mentioned, all variables in Apex are strings. Whenever you do something with them that effectively requires something other than a string value the database does an implicit type conversion. This often works, but not in cases where the db doesn't know how to do the conversion. For example, if your default database date format is dd-mon-yyyy and you have a string 10/09/2007 the database won't have any idea how to convert it to a date. That same is true for number formats.
In your case, you used the number format mask in apex to convert a number to a string witht the given format. Apex does not do anything to convert it back to a number when you submit the page (unless you use the built in row processing). If you want to do anything with it as a number, you need to change it back with the to_number function. The second parameter is the format mask of the string you are passing in.
Hope this helps,
Anton -
Page Item / Source / Format Mask - Table Column Numeric
Form page to maintain a table row, the item is for a numeric column. Selected/Entered the format mask "999G999G999G999G990D00" for the Page Item / Source. I was under the impression that this would result in the page item being formatted with the mask when navigating out of the item. I can enter non-numeric values and navigate out with no error being raised/reported ... is this expected behaviour?
ThanksAPEX was touted at being a MS Access application killer and a RAD tool. If the user is presented with having to understand the complexities of session state variables, page item variables, etc. then a lot of developers/users will be switched off. APEX was supposed to appeal to the masses as the pipes and plumbing coding behind having a web application front end on an Oracle database backend was being hidden. The converse seems to apply when implementing functionality like a format mask being applied both on entry and display of several page items. So I may be able to implement the required format validation using Javascript but if I have to apply this functionality to more than one page item in now way does APEX lend itself to RAD, e.g. In Oracle Forms you could select multiple Block/Items and then change a property to apply to all the selected items.
-
Date format in text item-solved
Two text item with data type date.I insert dates in the text item in the format for ex.
01-jun-07 but the text item takes it as 01-jun-0007.
how to correct the format?
Message was edited by:
user588306Hello,
in the formate mask property of the text item write :
dd-mon-rrrr or dd-mon-yyyy
regards,
Abdetu.. -
Report - Formatting text IN text items
I'm trying to create a report with (at the end of the report) a text field extracted from the (Oracle) database.
A user creates the value of the field, with a sort of HTML formatting on the text (to make text in BOLD is used <B> and </B>, for ITALIC <I> and </I> and to UNDERLINE...).
If I generate the report in HTML format everything is OK, but in PDF format I've got the tags written with the text.
This mean that instead of having:
"Hello World"
I've got
"Hello <B>World</B>"
Is there a way to let Oracle Report display a text item with some words in BOLD (ITALIC, etc) and some others not?
I've tryed the "Contains HTML Tag" without any result, I'm currently using 6i, but I can switch to 9i.
Any help or suggestion is greatly appreciated.
ThanksStephen Schulte2 wrote:
Sagesse wrote:
To quote text, put "> " (without quotes) in front of the text you want indented.
OK I used the ' " ' to put your message into a box at the start of mine, but I don't seem to be able to use the ">" to "indent" my text... For example-- the following is not indented: >So now I am putting this text here in quotes, let's see via PREVIEW.
No, that doesn't seem to do anything...
Steve
You have to put the > character at the beginning of a line.
Alternatively, you can use this HTML to set off text as a blockquote without the background:
<blockquote style="margin-left: 50px;">Quoted text goes here</blockquote>
Which will render your text like this:
Quoted text goes here
You can add your own background color like this:
<blockquote style="background:lightblue; border:1px solid black; padding:3px; margin-left: 50px;">Quoted text goes here</blockquote>
Where 'lightblue' can be replaced with any CSS or HTML color name.
This will render your text like this:
Quoted text goes here
Maybe you are looking for
-
How can i transfer my music from ipod classic to itunes on imac
have an ipod classic, just switched from pc to imac. would like to load my music from my ipod to my imac. how can i do this?
-
Spinning wheel of death when try to sync itunes with ipod
I've had no bother from syncing my ipod until today and then for no reason I now keep getting the spinning wheel of death. When my ipod is connected and on auto sync mode it gets recognised, says it's syncing and then totally freezes. The only way to
-
In SD, assign programmatically an external sales doc nbr
Hello, we have a sales document type that will be need to be externally assigned a sales document number in txn VA01. Right now it is configured to be mandatory. The requirement is to go to txn VA01, enter the sales doc type, hit enter, and then hav
-
Instalation Problem - 10g - DHCP machine - Forms too slow if connected
Just installed the latest release of Oracle Database and Developer Suite (10g) on a machine with cable connection to the Net, with DHCP. Followed the instructions regarding the installation of the Loopback Adapter. It was not possible to follow all t
-
What are best options for home Mac Wi-Fi setup?
Having a newer 3rd gen iPod Touch and planning on getting an Apple laptop ... what are some of the better Wi-Fi options to setup in my home environment (using indoors and around the house, patio, etc.? I'm obviously aware of Apple's products like Air