How to validate numbers in char field.
Hello all,
I have one database column with char data type. This field should allow insert only
numbers [ zero to nine] and plus symbol .. how to validate this?
Pls help me..
I.m using oracle 9i database. So it does not allow REG-EXP and WITH methods.. So give some
sql coding to do this
As this forum is for issues with the SQL Developer tool, you'll probably get more answers in the SQL And PL/SQL forum.
Regards,
K.
Similar Messages
-
How to validate a select-option field on the selection- screen
Hi,
I need to validate a selection-option field in the selection-screen.
Requirement is : i need to read each of customer number one by one and validateCan you please me in achieving this.
Best Regards
Mamatha.Bhi,
chk this sample code.
SELECT-OPTIONS : s_kunnr for kna1-kunnr.
AT SELECTION-SCREEN.
if 'S_KUNNR-HIGH' = "condition
"put your required validation here
endif.
rgds
Anver
Message was edited by:
Anversha s -
Hello,
I have a field 'A' that is CHAR(8)
How do I trim this field to compare with other records that are Varchar2() fields?
Will the Trim function work? like trim(A). I know you can trim a Varchar2 field.SQL> create table t (c char(10), v varchar2(10));
Table created.
SQL> insert into t values ('test','test');
1 row created.
SQL> select length(c), length(v), length(trim(c)), length(trim(v)) from t;
LENGTH(C) LENGTH(V) LENGTH(TRIM(C)) LENGTH(TRIM(V))
10 4 4 4
SQL> select * from t where c = v;
no rows selected
SQL> select * from t where trim(c) = v;
C V
test test
SQL> -
How to Validate a Portal Form field from the database
I created a Portal Form based on a procedure, which requires three parameters. One of the parameters is Item Number. I need to check if the Item Number exists in database. I am trying to use pl/sql button event handler, where I try to use the select count(*) statement to verify. However, I don't know how to reference the form field in the where clause. Please advise. Or is it possible to achieve this by creating a javascript? If you go to 'Shared Component' provider and click on javascript, you will see some system validation scripts, which you can call in the form level validation. My doubts with javascipt is how I can talk to database in the script? Any input is appreciated.
Hi,
You cannot access the DB from the script. If you want to access the values of a field you should use session variables. Here is a sample to access the values of a form field.
declare
ticket_no varchar2(20);
flight_no varchar2(20);
blk varchar2(30) := 'DEFAULT';
begin
ticket_no := p_session.get_value_as_varchar2(
p_block_name => blk,
p_attribute_name => 'A_TICKET_NO');
flight_no := p_session.get_value_as_varchar2(
p_block_name => blk,
p_attribute_name => 'A_FLIGHT_NO');
end;
Thanks,
Sharmila -
How to validate the input field
Hi,
I have a input form which is draged from input port of a RFC.
in this input form i have two input fields nad submit button.
on of this input field should always take the character values only. it should not take any numeric value
and other input field should always take numeric value only.
i.e how to validate this two input fields.
regards
srinivasHi,
U can validate input fields using javascript.Write OnClientClick function for that submit button if ur using htmlb or onClick if u r using html.Refer the follows
http://help.sap.com/saphelp_nw70/helpdata/en/03/900e41a346ef6fe10000000a1550b0/frameset.htm
There are two ways to achieve ur task.
1.By checking for all alphabets.in this u need check all the alphabetic characters one by one.Refer the following
http://www.shiningstar.net/articles/articles/javascript/javascriptvalidations.asp?ID=ROLLA
http://www.shiningstar.net/articles/articles/javascript/checkNumeric.asp?ID=AW
2.By using regular expressions.its very easy and a single line code.here u need to specify single expression for whole alphabets.Refer this
http://aspzone.com/blogs/john/articles/173.aspx
Everything has been given for validating in javascript.i hope u also validating in javascript only.
For more details on "Regular expressions" search google.
Regards,
Tamil K -
How to validate selection-screen field
Hi all,
How to validate a selection-screen field defined as a select-options.for Ex i declared a selection-screen field select-options:s_matnr for mara-matnr.
Then how to validate this field.Hi,
write the below code in AT SELECTION-SCREN.
EX :
AT SELECTION-SCREEN.
*-- Validate the Selection screen data
PERFORM VALIDATE_SELSCR_DATA.
WRITE THE below code in Form "VALIDATE_SELSCR_DATA".
IF S_MATNR[] IS INITIAL.
*--MATNR is initial.
message e000(MsgCLass) with 'matnr is empty'.
ELSE.
SELECT MATNR
INTO MARA-MATNR
FROM MCHA
UP TO 1 ROWS
WHERE MATNR IN S_MATNR.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'Invalid MATNR entered'.
ENDIF.
ENDIF. -
How to validate an text field item using javascript for numbers only.
hi,
how to validate an text field item using javascript for numbers only.please help me on this urgent
please mail me solun if posible on [email protected]Hi,
Page HTML header
<script>
function onlyNum(evt) {
// Usage: onKeyPress="return onlyNum(event)"
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
var status = 'This field accepts numbers only!';
alert(status);
return false;
var status = '';
return true;
</script>Item HTML Form Element Attributes
onKeyPress="return onlyNum(event)"Br,Jari -
How do I make a form field validate that it is the sum of two other fields?
Hi there,
I am creating a form, and I would like one of the fields to validate by making sure that this field is the sum of two other fields in the form. Does anyone have any ideas on how to go about this? I know I'll need to run a custom validation script, but I'm not sure where to begin - I've never done one for validation before.
Thanks for any help!OK, here's a sample script that I hope will clearly demonstrate the general approach. It is intended to be the custom Validate script of the field that the user enters that value that is supposed to be equal to the sum of the two others.
// Custom Validate script
(function () {
// Get the value that the user entered
var sVal = event.value;
// If it is blank, do nothing else
if (!sVal) {
return;
// Convert string to a number
nVal = +sVal;
// Get the values of the fields, as numbers
var v1 = +getField("text1").value;
var v2 = +getField("text2").value;
// Add them together, rounding to two decimal places, converting to number
var sum = +util.printf("%.2f", v1 + v2);
// Compare entered value to the sum of the other two fields
// Alter the user if they do not match
if (nVal !== sum) {
app.alert("The value you entered does not equal the sum of text1 and text2. Please correct.", 3);
// If you want the entered value rejected, include the following
event.rc = false;
Replace "text1" and "text2" with the actual field names. -
How to make numbers in message text input fields left aligned?
Hi Friends
I have completed one of my task .but getting result right side of the field.
how to make numbers in message text input fields left aligned?
Thanks
AravindaHi ,
Sorry for late replay i am trying this alos not set that page....
pageContext.forwardImmediatelyToCurrentPage(null, true, null);
and one more that kff field working is fine for ex display any text pled displayed properly and only problem is not set the value and HrSitKeyFlex6 and HrSitKeyFlex7 fields are perfectly get the values but not pront HrSitKeyFlex8 that only my issue....
Regards,
Srini -
How to get Numric value from a Char field in the database?
I have the following values in a column in Database.
COMP
GRADE
CANC
CANCELLED
Comp
Complete
INCOMP
NC
NS
85%
79
88 .... etc....
I have to take the value from this field if it is a Numeric other wise I have to ignore that value.
Please let me know how to handle this?
Thanks,
LakshmiThanks for the inputs.
Here I want to take the value if it is numeric else I
will ignore that record.
Please let me know how to validate the data for a
Numeric value.
I don't want to stop my program by throwing these
exceptions.The sample code catches the exception. At that point you can do whatever you want (set a boolean to say the value is not a number, etc.) - the program does not stop. -
How to Place the Cursor at Specific Position with-in a Char Field ?
Forms 4.5 ver.
Sun Solaris / Citrix env.
Char Field - Length 65434
How Can I Place the Cursor at "Specific Location"
with in a Field ?
with GO_ITEM('field Name') I can place the Cursor at Specific Field.
But, How Can I achieve to Place the Cursor at Specific
Position within that Field ?
I know, the starting position, length of string I want to hightlight with the Cursor.
tried using :
go_item('substr(field_name,position,length)') ;
but didn't work !
Is it possible ?
Thanks, PeriThe only cursor postion behavior that can be controled is the item property "Keep Position".
The following is the text from the on-line help for item property "Keep Position"
KEEP_POSITION Specifies whether the Keep Position property should be True or False. When Keep Position is True, the cursor returns to the same position it was in when it left the text item. When Keep Position is False, the cursor returns to the default position in the text item. Valid values are PROPERTY_TRUE and PROPERTY_FALSE. -
How to validate Quantity field in TV - Inputfield ?
Hello All,
I'm using a table view to show the output .
IN this table view I made 2 fields as Input fields.
Both the fields are Quantity fields.
Now when the user enters a value in this Quantity field I want to validate it with respect to it's units .
How can I do that ?
In my case if the user enters correct value it works but when he enters a wrong value my BSP is going for a dump.
I tried to debug the<b> LIPS table</b> to verify how SAP was handling this checking for the field <b>LFIMG</b>. But there there is a statement called chain --endchain.
SO there is no chance for debugging.
My code is as follows :-
LOOP AT gt_final INTO wa_final.
CLEAR: gv_row,lv_qty,lv_string,gv_len,gv_cell_id1.
gv_row = sy-tabix.
gv_len = STRLEN( gv_row ).
gv_len = gv_len - 1.
* Modify the Third Column
CONCATENATE 'INB01_TV_ID' '_' gv_row(gv_len) '_' '3' INTO gv_cell_id1 .
lv_string = request->get_form_field( name = gv_cell_id1 ).
WRITE lv_string TO lv_qty UNIT wa_final-units.
CLEAR :wa_final-del_quantity.
wa_final-del_quantity = lv_qty.
MODIFY gt_final FROM wa_final TRANSPORTING del_quantity.
ENDLOOP.
Can anyone tell me how to validate the entry for the Quantity filed ?
Regards,
Deepu.K
I have one more Question .
Whenever BSP goes for a dump in this case I want to handle this by a message .
Is it possible ?
Message was edited by:
deepu kHello Raja,
I want to validate the entry in the QUantity field with respect to the Unit of the Quantity.
I.e say for example I have a unit as PC (pieces) then the quantity must be only of thousands,lakks and so..on......but not in points i.e a piece quantity must be full either 200 ,2 lakhs or 2 pieces but not 2.5 pieces.
SO now if the user enters 2.5 it's a wrong value as the quantity for the Unit PIECES can't have half-piece. (2.5 = 2 + 0.5) .SO i want to validate this .
I hope I'm clear.
How should I do ?
Regards,
Deepu.k -
How to validate the field when i am populating the data cursor to block
Hi,
I am populating data cursor to multi record block.
Block contain 5 items. I am populating data cursor to block for 4 items. User will enter one item value that is quantity field.
If user enter negative values and decimal points in quantity filed i need to display message to user item level.
Please do the needful how to do it.902434 wrote:
Hi,
I am populating data cursor to multi record block.
Block contain 5 items. I am populating data cursor to block for 4 items. User will enter one item value that is quantity field.
If user enter negative values and decimal points in quantity filed i need to display message to user item level.
Please do the needful how to do it.If you want to validate at entry level then use When-Validate-Item trigger and check the input and show message. Like
If :quentity <0 then
message('do not enter negative value');
message('do not enter negative value');
raise form_trigger_failure;
end if;Why u open same thread again ? not closing one.. check this one
</a>
How to validate the field when i am populating the data cursor to block
Hopes this helps
If someone's response is helpful or correct, please mark it accordingly. -
How to validate input fields as the user is filling up a form with jQuery?
Hello EA friends.
Someone has experimented on how to validate input fields as the user is filling up a form with jQuery?, if the field is numeric and insert an A for example, an alert appears showing "insert a number" or not allowed to enter anything until a number is entered.
Thanks and regards.
FerHi Sudeshna.
Sorry for not responding on time, how can I be included in this code?
sym.setVariable("typeActivity", "input")
var Element_1=document.createElement(typeActivity);
$(Element_1).css({"text-align": "center"});
//Answer
sym.setVariable("Answer_1", "4");
sym.$("box_1").append(Element_1)
This code is on my creationComplete and it works fine.
Would greatly appreciate your help.
Regards.
Fer García -
How to validate the fields and how to display the error messagein presenta
Hi,
I am new to OBPM 10g, pls tell me how to validate the fields in a presentation.
for example if we take login presentation if user enters his user name and password wrongle and submit the form. Then we need to display error message right side of the each field i.e user name and passowrd is wrong and try again.
Regards
jaya
Edited by: 12345 on Aug 12, 2010 10:38 PMHi Jaya,
You can initially set the validation for empty values.. that is when the user dint enters any value and clicks on submit.
for these vadliations you need to write a method and call it on submit button click!!
secondly, you can validate for the format if required.
thirdly, you can validate against a database for the credentials. For this you need to fetch list of usernames from database and search for user entered value in that list.
Optimal query would be : if user name not null, query for pwd of the entered user name from database or file storage. if you dont get any value for pwd of given username, its incorrect user name. if you get some pwd value for username, then check against the one user entered in pwd field..
Write all this logic in a method and call on submit button click event of the login form!!
HTH
Sharma
Maybe you are looking for
-
Every time I make a new note, or even when I simply update an existing note (this can be a minor change such as one letter) an email is sent to my Gmail. It never shows as an unread new email in my inbox, but it's there, in my "All mail" folder. I no
-
I have/had no trouble with Firefox at all. What I have is a new computer, with multiple users. I would like to use my relatively secure Firefox setup (i.e. NoScript with a LOT of configuration and site data stored, PrefBar and TabMix configuration, a
-
We can print with USB plugged in but wireless shows as offline and obviously doesn't print. On the listed products that use ePrint, the 400 Laserjet series is listed for Color only. This is not a color unit.
-
Can anyone help? I upgraded my iPad to 5.1 sent my apps to iTunes I see the apps but can restore them I don't see restore anywhere HELP thanks to all who canhelp
-
Jaxrpc interoperability with other programs (perl)
hello: I loaded the simple test program for webservices jaxrpc-simpe/simple and tested agaist the java client as provided in the j2ee1.4 samples. Now, i am trying to test its accessibility from other platforms using xmlrpc. Specfically i am using the