Validation To check numeric value
BEGIN
IF :P3_TOTAL_AMOUNT >= :P3_NET_AMOUNT THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;
The function returning boolean should compare total amount and net amount and through error if it less than net amount.
It works fine when the value of TOTAL amoun =365 and value of net amount = 364*(if it is all numeric value and no zero behind it)*
But the problem is
when is use Total amount = 9 and net amount = 100 (It doesnt works becuse it just takes 1 from the net amount and eliminates the zeros behind the 1(100) and it doesnt comes up with a error after validation )
Is there any one who can help me with this
Thanks,
Hary
Lev,
I'm not sure I follow. If you use to_number with a format mask and the user doesn't follow your mask, you'll get an error:select to_number('1000','999G990') from dual;This throws an "ORA-01722: invalid number" exception. That's why I say to try calling to_number without a format mask first, to handle the trivial case of the user not putting in the grouping separators (or whatever else is involved in your format).
You could, of course, put in a validation to make sure that the number follows the format you're expecting before you convert it (either for further validation, as in the original post, or for processing), but then you have multiple places where the format mask is specified--not to mention the annoyance for users when they put in a number only to be told that they need to use the appropriate grouping separators as well. My solution uses the data dictionary to get the format mask assigned to the page item and feeds that to to_number; if I change the page item's format mask, all of my processes automatically handle the new format. Because of the extra lookup, it's slightly slower than hard-coding the format mask, but that should be minimal as long as you don't use it in a where clause.
-David
Similar Messages
-
Validation on numerical values in webdynpro
Hi Friends,
I am facing one probelem with validation on numerical values. In my application there is a scenario.. Input fields are Mibile number and email id.
when i enter the invalid phone number like : 09988wertyy it should throw the error like enter only numerical values.
In the same way i should validate the email id with format .. like ratnakar.alwala@ accenture.com. if it is in valid then it should throw the error.
could any body please give me the approach.
Thanks and Regards
Ratnakar reddy alwalaHi Ratnakar,
For number validation, what I did was :
1. Bind a context variable (Say Number) of type String to the input Field
2. At the time of submission, do the following
String num=wdContext.xurrentContextElement().getNumber();
if(num!=null)
try
double num=new Double(amnt.trim()).doubleValue();
catch(NumberFormatException exc)//IF AMOUNT ENTERED IS NOT VALID
wdComponentAPI.getMessageManager().reportException("Invalid Number",true);
Regards
Fahad Hamsa -
How to check non-numeric value in a field
Hi all,
I have a field 'MVALUE'. HOw can I check if I have a non-numeric value in my field. Let us say if I have a value '<25' in this field. How can I check if the value in this field is non-numeric. The field MVALUE is of CHAR datatype.
Please help. Waiting.........Might have to add a space in the string...
if not mvalue co ' 0123456789'.
* error
endif.
if you allow decimals and commas...
if not mvalue co ' .,0123456789'.
* error
endif. -
How to check whether a field contains at least one numeric value
how to check whether a field contains at least one numeric value..
Hi,
I hope that this code will works.
constants:
c_digit_grp TYPE char11 VALUE '0123456789', " Digit group
* Data Declaration
data :
str type string.
* if you want check entire string and pass entire string
if str CA c_digit_grp.
* write your logic ---this block will execute atleast one numeric value exists in the string
Endif.
Regards
Bhupal Reddy -
Validating numeric value in a filename
I have a file and the filename should be like ABC_12345_RES_20150410.txt and i have to validate the filename.I am facing problem in validating the numeric value which can change and its length also can change.
I am using the following expression to validate whether its the numeric value /not:
(DT_I4)(SUBSTRING( @[User::FileName] ,FINDSTRING( @[User::FileName] ,"_", 1)+1, FINDSTRING( @[User::FileName] ,"_", 2)-FINDSTRING( @[User::FileName] ,"_", 1)-1)) == (DT_I4)(SUBSTRING( @[User::FileName]
,FINDSTRING( @[User::FileName] ,"_", 1)+1, FINDSTRING( @[User::FileName] ,"_", 2)-FINDSTRING( @[User::FileName] ,"_", 1)-1))
This statement is failing the package when i am entering a character instead of digit.. But i don't want the package to fail rather i just want to log the exception in this case.
Is there any other way to validate the numeric Value?
Many Thanks in Advance!Thanks a ton Martin for your advice.
I can do that but Actually the conversion is failing.. its giving error that cannot convert to (DT_I8). M looking for any other way to validate the numeric value. -
Validation of numeric value precision and scale
Hi all,
Iam using ADF with EJBs.
I have one inputText field that will accept numeric values (of java.lang.Double type). Due to database constraints I want to validate the input value on its precision and scale.
I put an f:convertNumber tag under the inputText and set the MaxIntegerDigits and MaxFractionDigits properties with the desired values.
I also set the ApplyValidation property of the corresponding attribute in the pagedef file. However no validation worked.
I made the same test with af:ConvertNumber with no result too.
I know that with BC4J it is easy to set such constraints at the entity level.
Is there any neat way to set validation or I need to write code in the backing bean?<af:convertNumber> works fine for me. see the following code
<af:inputText id="it1">
<af:convertNumber type="number" minFractionDigits="2" maxIntegerDigits="4" maxFractionDigits="2"/>
</af:inputText>
Another possible solution with regular expression
<af:inputText id="it3" value="9999.99">
<af:validateRegExp pattern="\[0-9\]\[0-9\]\[0-9\]\[0-9\].\[0-9\]\[0-9\]"/>
</af:inputText>
regards
srini
Edited by: sangara on Jan 17, 2010 9:53 PM -
Limiting entry in a JTextField to numeric value and "%" value
Hi,
I want to allow the user to enter numeric value and % value
How can I limit the user to make such a entry in JTextFieldUse the code given below to make your textfield accept only numeric values. You can modify itto include % values too.
textField.setDocument( new TextFieldVerifier() );
class TextFieldVerifier extends PlainDocument {
public void insertString( int offset, String str, AttributeSet attSet ) throws BadLocationException {
boolean valid = false;
if ( str == null ) {
return;
String old = getText( 0, getLength() );
/* insert the new string at the given offset, into the old string */
String newStr = old.substring( 0, offset ) + str + old.substring( offset );
try {
/* check if the new string is a valid integer */
Integer.parseInt( newStr );
valid = true;
} catch ( NumberFormatException ne ) {
/* invalid, if not an integer */
valid = false;
Toolkit.getDefaultToolkit().beep();
if ( valid ) {
super.insertString( offset, str, attSet );
} -
Function module to validate numeric values
Hi all.
Can some one please tell me Is there any Function Module to validate only numeric values?
Like in year variable, it can never contain alphanumeric values or special symbols?
Is there any function module to check, wheather the variable contains only numeric values, no alphanumeric value or special symbol?
If there is no as such function module then what is the alternative approach we can take?
Plz help me .
Regards
DipankarFunction Module NUMERIC_CHECK for Editing and checking numeric fields ( i.e. Num validations)
Check using the Function Module "NUMERIC_CHECK".
CALL FUNCTION 'NUMERIC_CHECK'
EXPORTING
STRING_IN = X
IMPORTING
STRING_OUT = X
HTYPE = H_TYPE.
if h_type = 'CHAR'.
WRITE:/ 'Not Numeric'.
else.
write:/ 'Numeric'.
ENDIF.
REWARDS IF USEFUL
GAURAV J.
Edited by: GAURAV on Feb 3, 2008 2:19 PM -
Converting char to numeric value
I have table with social security no. but application does not
have any validation for data so i get all different kinds of
data like...
123-24-0988
123458900
n/a
N
f234-90-8877
12 345 6789
Now i want to remove all '-' and alpha char from value and just
want to remain only nuemric characters so i can use it as where
parameter.
Is their any function that i can use for this or any other logic
that i can use for this?
ThanksAs demonstrated in a previous discussion regarding checking for
numeric values, translate does not produce the proper results
when you translate it to a null value. However, you can achieve
the desired results, by translating to spaces, then replacing
the spaces:
UPDATE table_name
SET ssn = REPLACE (TRANSLATE (LOWER
(ssn), 'abcdefghijklmnopqrstuvwxyz- ', ' '), ' ', ''); -
Looking for help with javascript to autofill checkboxes based on a numeric value.
I have a numeric field that I would like to have 1 - checkbox
out of five autofilled based on a numeric value.
For instance the numeric value is TotalPoints
If the TotalPoints Value is >10 autofill this checkbox
If the TotalPoints Value is 10 - 19 autofill this checkbox
If the TotalPoints Value is 20 - 49 autofill this checkbox
If the TotalPoints Value is 50 - 69 autofill this checkbox
If the TotalPoints Value is 70+ autofill this checkbox
Assistance in writing the correct script for this would be greatly appreciated.All the checkboxes have separate names.
Check box #1 is AssetClass.0 with the export value of 1
Check box #2 is AssetClass.1 with the export value of 2
Check box #3 is AssetClass.2 with the export value of 3
Check box #4 is AssetClass.3 with the export value of 4
Check box #5 is AssetClass.4 with the export value of 5
Score and StrategyUse the following calculation to determine your point score and indentify the appropriate strategy listed below.A. Add your points for questions 1 – 2.
B. Add your points for questions 3 – 12.
C. Subtract B from A. (Numeric Text Box) name is TotalPoints
Points Strategy Asset Class Mix (check boxes as named above)
0 – 10 Primarily Fixed Income: 80% Fixed Income; 20% Equity
10 – 19 Balanced Fixed Income-Oriented: 60% Fixed Income; 40% Equity
20 – 49 Balanced Equity-Oriented: 40% Fixed Income; 60% Equity
50 – 69 Primarily Equity: 20% Fixed Income; 80% Equity
70+ Equity: 95%; 5% Cash -
Popup Key LOV, NULL and "Invalid numeric value undefined for column"
Hello.
I've created an item based on database column of NUMBER type and set the following properties:
Display As = Popup Key LOV (Displays description, returns key value)
List of values definition=select 'display_value' d, 1 r from dual
Null display value=%
Null return value=
Display Null=Yes
When I select "%" in the LOV and try to apply changes to database I get error:
ORA-20001: Error in DML: p_rowid=1781, p_alt_rowid=N1, p_rowid2=, p_alt_rowid2=. ORA-20001: Invalid numeric value undefined for column N2
Error Unable to process row of table TTT.
If I set Display As = Select List, all works fine. But I need Popup Key LOV.
Could anybody help me?
I use Application Express 2.2.1.00.04Hi all,
I did my homework and solved this issue. First I would like to thank Patrick Wolf for the invaluable help he gives out on thread Re: Null value handling in LOVs The code presented here is just a minor edit to his code, but an essential one when dealing with Popup Key LOV items.
Here's what I did:
1. Create an Application Process.
Name: RemoveNulls
Sequence: 0
Point: On Submit: After Page Submission - Before Computations and Validations
Process Text:
BEGIN
FOR rItem IN
( SELECT ITEM_NAME
FROM APEX_APPLICATION_PAGE_ITEMS
WHERE APPLICATION_ID = TO_NUMBER(:APP_ID)
AND PAGE_ID IN (TO_NUMBER(:APP_PAGE_ID), 0)
AND LOV_DISPLAY_NULL = 'Yes'
AND LOV_DEFINITION IS NOT NULL
AND LOV_NULL_VALUE IS NULL
LOOP
IF (V(rItem.ITEM_NAME) = '%null' || '%' OR V(rItem.ITEM_NAME) = 'undefined')
THEN
Apex_Util.set_session_state(rItem.ITEM_NAME, NULL);
END IF;
END LOOP;
END;Error Message: #SQLERRM#Condition: None
2. You should be able to submit a Popup Key LOV with a NULL value now.
Once again, THANKS, Patrick! You rock! I'm seriously thinking of trying ApexLib now :)
Georger -
Editing a field in ALV and validating the newly entered Value
Hi Experts,
I have an ALV report in grid display (not object oriented). My requirement is to edit a field on the output and write the validations to validate the value that was edited on the ALV output.
This can be done using object oriented coding by using the method check_changed_data. For this to happen, i need to change the entire scope of my report into object oriented, which is like reinventing the wheel.
Since my report was developed using classical ABAP, what needs to be done to get this functionality. Any suggestions are welcome.
Thanks.in the FM 'REUSE_ALV_GRID_DISPLAY' import parameter IS_LAYOUT check out the columsn EDIT and EDIT_COLUMN. Also Use FM 'REUSE_ALV_EVENTS_GET' to get list possible event and pass a subroutine name which will be called when ever event is fired.
example:
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = l_events.
READ TABLE l_events WITH KEY name = slis_ev_top_of_page
INTO g_event.
IF sy-subrc = 0.
MOVE top_of_page TO g_event-form.
APPEND g_event TO t_events.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = t_repid
is_layout = t_layout
it_fieldcat = t_fieldcat[]
i_save = t_save
it_events = t_events[]
TABLES
t_outtab = g_editpos1[]. -
XDOFX if-then-else command testing of space and numeric value
Hi,
I have the following xdofx statement in a RTF template to display the value of one variable or another, depending on the value it contains: (the variable can contains both space or null or a numeric value).
<?xdofx: If Amount_1 = " then 'display amount_2' else If Amount_1 = 0 then 'display amount_2' else 'display Amount_1' end if?>
Result: When Amount_1 variable contains space or null value, then this If-then-else statement works. But When Amount_1 contains a number such as 0, it gives error "SBL-OMS-00203" (when it's checked against [=" ] in If condition). What's causing this? Is XDOFX being confused to test a variable that supposedly a character string (default by testing against [ =" ]), but find a number in the variable?
Any work around solution? (So [=" ] and [=0 ] can both be specified against a variable in an if-then-else statement in XDOFX).
Thanks a lot.
A.try
<?xdofx:if (Amount_1 =’’) then ‘display amount_2’ else if (Amount_1 =’0’) then ‘display amount_2’ else ‘display Amount_1’ end if?>or
<?xdofx:if (Amount_1 =’’) then ‘display amount_2’ else if (to_number(Amount_1) =0) then ‘display amount_2’ else ‘display Amount_1’ end if?> -
Error message - BSEG-WRBTR enter a numeric value
Hi,
I am having a problem with loading data using a abap program that calls RFBIBL00 program and the fb01 Transaction. The process is that the user enters the data in a excel sheet, saves as a tab deliminted txt file. The abap program reads the txt file, does some processing and submits the RFBIBL00 program with the FB01 code. When I check in SM35, it shows on the "incorrect " tab. When you display the log for the process, It is displaying "Formatting error in the field BSEG-WRBTR; see next message" and "Enter a numeric value". I am not sure where to start looking to try to correct this problem. I am tracing the abap program that submits the RFBIBL00 process and I am not finding where this is occuring. I am new to the ABAP world and I am having a hard time figuring this out. Can someone please let me know if I am proceeding in the right direction or if there is another way of solving this. I am not sure what program is generating the above error messages. If there is more information that is needed, please let me know and I will try to get it for you.
thanks in advance for the help on thisHi,
There may be two possiblities for this issue.
1. Incorrect data passed to the field BSEG-WRBTR
2. Check the Decemial Notation(Menu Path->System->status->Own profile and Defaults Tab). If it is diffrent with the entered amount format, then it will trigger error.
YOu can run the Bach in the fouground by choosing fouground radio button option in the Pop up.
Thanks,
Ramakrishna -
Can one assign a numerical value to a variable?
Hi All,
Good afternoon,
I am currently working on a form that has strings as values in 2 different listboxes, and depending on what is selected a message pops up. Here is the script I wrote, but it does not seem to work right
var a=aKlaclistbox.raWvalue=="SSK";
var b=bZlaslistbox.raWvalue=="SGT";
a.value=1;
b.value=2;
if(a > b){
xfa.host.messagebox("You cannot select a lower officer as the rating officer");
It does not work, and I am just wondering if there is any way I can get around it so that I can compare the values. I need help from anyone on this forum.
Thanks
v/r
TammyThere's probably a better way of doing this, as, depending on how many ranks you have, it could get cumbersome. Like using an array or something like that but not sure how to accomplish that.
If there are a lot of ranks to compare I think I'd suggest reworking things so that you can use the numeric value of the list box, it will be much easier in the long run.
As I mentioned above, I don't think the following is valid code:
var a=aKlaclistbox.raWvalue=="SSK";
Nor is (unless dealing with global variables):
a.value=1;
I think you need to do something like the following (hopefully someone else around here might have a better idea!):
var a;
var b;
if (aKlaclistbox.rawValue == "SSK") {
a = 1;
if (bZlaslistbox.rawValue == "SGT") {
b = 2;
//You would need a series of else/if with the above to map the different rank values.
if (a > b) {
xfa.host.messagebox("You cannot select a lower officer as the rating officer");
Maybe you are looking for
-
Error message after updating for Windows XP
I just tried to do an update for my Windows XP but now it is saying AdiADID_AcquireMatchSlotif Necessary could not be located in the dynamic link library iAdCore.dll? Has anyone had this message before? I completely uninstalled I-tunes and tried to r
-
Photoshop CS4 will not open Nikon (NEF) raw files.
I recently tried CS6 Suite. Trial was over and I went back to Photoshop CS4. However, it would not open Nikon (NEF) raw files. I uninstalled and re-installed the PS CS4. This did not fix the problem. Can anyone help? Thanks, Derrick
-
Hi all, is there any tcode to create a report of sales dicided on monthly basis in following manner... Sales Rep...Jan...Feb...March...April...etc. Total Thanks, Anurag.
-
Not getting total of results row in bex query
Hi Experts, In Bex I have created new formula variable which is the Percentage of On time delivery for a particular vendor. The problem is when I use calendar year and vendor in rows and CK in columns and execute the query, I am not getting the the t
-
I am looking to seperate my icloud account from my wife's in one apple ID
I am looking to seperate my icloud account from my wife's in one apple ID