Removing characters from an input data-field

Hi.
Is it possible to "Trim Off" characters from a Text Field data, and automatically input them into another Text field?
Let's say I have the following code :
*<Field name='telephonenumber'>*
*<Display class='Text'>*
*<Property name='title' value='Phone Number in International Format'/>*
*<Display>*
*</Field>*
This code is to input the telephone number in International Format (such as :  +1 234 567 8900)
Now, lets say that I want to create a second Data Text field for phone number; but, this time, it is for the phone number in LOCAL format.
In other words, I want to write a code which will AUTOMATICALLY  remove the first 3 or 4 characters from the "International Number",  and input them into the "Local Number"  field.
This would save me the trouble or writing the number a second time. My code should be able to simply Trim Off the initial "+1 234", and automatically input the remaining "*567 8900"* into the Local Number field.
How could I accomplish this?
Thanks

Based on your code, it looks like you have fields called global.workgsmad (local style) and global.workgsm (international style)
Assuming your global.workgsm format will always be '+x xxx xxx xxxx' you want to skip the first 6 characters, not 4
The simplest way to do this is like so:
<Field name='global.workgsmad'>
   <Expansion>
      <substr>
         <ref>global.workgsm</ref>
         <i>6</i>     <!-- Skip the country code and area code '+x xxx ' -->
         <i>8</i>   <!-- 8 characters were left for the format 'xxx xxxx' -->
      </substr>
   </Expansion>
</Field>Alternatively, you could change the substr block to read
<substr s='6' l='8'>
   <ref>global.workgsm</ref>
</substr>Both formats are valid.
If the phone number is not a fixed format, you'll have to do something more complicated.
Jason

Similar Messages

  • Adf Javascript code to complete an input date field

    Hey guys,
    I have an adf input date field
    <af:inputDate value="#{MyBean.date}">
    <af:clientListener method="onEnterDate" type="keyPress"/>
    </af:inputDate>
    I want to implement a javascript function that completes the date field, means: when the user enters 10 in the field and presses the ENTER key on the keyboard, I want to complete the date with the current system time, like this (10/11/2011), so how can I do this...
    Thanks in advance..
    AccadSoft

    You could write a [url http://myfaces.apache.org/trinidad/devguide/clientValidation.html]client-side converter to do this.
    John

  • How to calculate AGE from two different date fields

    hi
    I need to calculate AGE from two different date fields.
    Can some help me how to do, when i try to do substraction formula it is showing error.
    Thank You
    Manu

    Manu wrote:
    Hi
    Both fields are in date format only, i need to calculate no . of days between two different dates
    Thanks
    ManuThe reason for the question about the format of the column is because the simplest solution only works on DATE columns. Others have mentioned this here, but if you want the difference between two date fields, you can use this formula:
    TIMESTAMPDIFF(SQL_TSI_DAY, date_column1, date_column2)
    The above being said, you still didn't tell me what you did, or what error message you received. So again, if the above formula didn't work, what did you do? Where did you put the formula? What was the exact syntax you used? What was the error message you got?
    Please don't make us work more than we need to. Answer all the questions in your next post. Thanks.

  • How to send values from Acquire Input data through Xbee

    Hi,
    I've initialzed my joypad- Zebronics ZEBST50JP and can read data from Acquire Input Data. I've seen that button work with Boolean Logic(True or False) and Arrow keys work with axis logic(32767 to -32768).
    Now all i need to know is, How to send these values through Xbee(Connected to PC using USB Adapter) to another Xbee connected to an Arduino (with Servo motors)
    Thanks in Advance

    Now i have Intialized my joystick.. But still have confusion with sending to XBee Pro...
    Here is my Post, which has the file
    http://forums.ni.com/t5/LabVIEW/How-to-send-signals-through-XBee-connected-in-USB-port/m-p/2135382 

  • Removing characters from a String (concats, substrings, etc)

    This has got me pretty stumped.
    I'm creating a class which takes in a string and then returns the string without vowels and without even numbers. Vowels and even characters are considered "invalid." As an example:
    Input: "hello 123"
    Output: "hll 13"
    The output is the "valid" form of the string.
    Within my class, I have various methods set up, one of which determines if a particular character is "valid" or not, and it is working fine. My problem is that I can't figure out how to essentially "erase" the invalid characters from the string. I have been trying to work with substrings and the concat method, but I can't seem to get it to do what I want. I either get an OutOfBoundsException throw, or I get a cut-up string that just isn't quite right. One time I got the method to work with "hello" (it returned "hll") but when I modified the string the method stopped working again.
    Here's what I have at the moment. It doesn't work properly for all strings, but it should give you an idea of where i'm going with it.
    public String getValidString(){
              String valid = str;
              int start = 0;
              for(int i=0; i<=valid.length()-1; i++){
                   if(isValid(valid.charAt(i))==false){
                             String sub1 = valid.substring(start, i);
                             while(isValid(valid.charAt(i))==false)
                                  i++;
                             start=i;
                             String sub2 = valid.substring(i, valid.length()-1);
                             valid = sub1.concat(sub2);
              return valid;
         }So does anybody have any advice for me or know how I can get this to work?
    Thanks a lot.

    Thansk for the suggestions so far, but i'm not sure how to implement some of them into my program. I probably wasn't specific enough about what all I have.
    I have two classes. One is NoVowelNoEven which contains the code for handling the string. The other is simply a test class, which has my main() method, used for running the program.
    Here's my class and what's involved:
    public class NoVowelNoEven {
    //data fields
         private String str;
    //constructors
         NoVowelNoEven(){
              str="hello";
         NoVowelNoEven(String string){
              str=string;
    //methods
         public String getOriginal(){
              return str;
         public String getValidString(){
              String valid = str;
              int start = 0;
              for(int i=0; i<=valid.length()-1; i++){
                   if(isValid(valid.charAt(i))==false){
                             String sub1 = valid.substring(start, i);
                             while(isValid(valid.charAt(i))==false)
                                  i++;
                             start=i;
                             String sub2 = valid.substring(i, valid.length()-1);
                             valid = sub1.concat(sub2);
              return valid;
         public static int countValidChar(String string){
              int valid=string.length();
              for(int i=0; i<=string.length()-1; i++){
                   if(isNumber(string.charAt(i))==false){
                        if((upperVowel(string.charAt(i))==true)||lowerVowel(string.charAt(i))){
                             valid--;}
                   else if(even(string.charAt(i))==true)
                        valid--;
              return valid;
         private static boolean even(char num){
              boolean even=false;
              int test=(int)num-48;
              if(test%2==0)
                   even=true;
              return even;
         private static boolean isNumber(char chara){
              boolean number=false;
              for(int i=0; i<=9; i++){
                   if((int)chara-48==i){
                        number=true;
              return number;
         private static boolean isValid(char chara){
              boolean valid=true;
              if(isNumber(chara)==true){
                   if(even(chara)==true)
                        valid=false;
              if((upperVowel(chara)==true)||(lowerVowel(chara)==true))
                   valid=false;
              return valid;
    }So in my test class i'd have something like this:
    public class test {
    public static void main(String[] args){
         NoVowelNoEven test1 = new NoVowelNoEven();
         NoVowelNoEven test2 = new NoVowelNoEven("hello 123");
         System.out.println(test1.getOriginal());
         //This prints hello   (default constructor string is "hello")
         System.out.println(test1.countValidChar(test1.getOriginal()));
         //This prints 3
         System.out.println(test1.getValidString());
         //This SHOULD print hll
    }

  • Disabled input date field

    Dear Techies,
    i am using BSP with page flow logic.
    I have a date field, my requirment is i have to mandate the usage of date field only through the calander help which is provided by the input field, it should be disabled by the keyboard entry only for dat field.
    I disabled the input field on page load by using java script, and the input field is working fine, the changed value is appearing but the changed value is not being stored in the value attribute.
    When i debug the javascript is overriding the disabled property, please help me how can this be achieved.
    Regards
    Imran.

    hye Bhavana,
      Thanks for the patience.
    My requirement is:
    i should have an input field of type date, which should not be input enabled but it should accept values from the calender help. That means user should select only date from calender, but he should not be in a position change or enter values from keyboard.
    For this i have followed this approach.
    i have my htmlb tag for input.
    <htmlb:inputField id       = "tx"
                            value    = "<%= date %>"
                            showHelp = "X"
                            type     = "date" />
    And i have javascript which will disable it at the client side. This will only disable the input from a keyboard, but when i select date from calander it appears in the input field which is as per my requirment.
    Now when i am going for any eventing, the value in the input field is initialized. This is my problem. I want the input field to retain its value.
    If i dont use the javascript and make it enabled input field, i dont have a problem in rendering the change in date.
    So please give me any solution through the approach or i dont mind any new solution.
    Hope it is clear and once again appriciate your effort in understanding.
    Awaiting your response.
    Regards
    Imran.

  • Urgent, Please help !!! Input Date field in Mysql database using JSP

    Hi All,
    Please help me ! I am trying to store a date field in MySql databaseusing JSP on Tomcat Server.I am gettting the following error.
    I am taking the String Input and then trying to convert it into date type
    inorder to store it into date field in a database.
    I am using the following code :
    <%
    try{
    String dt=request.getParameter("avldt");
    SimpleDateFormat adt= new SimpleDateFormat("dd-MM-yyyy");
    Date sqlToday = new java.sql.Date(adt.parse(dt).getTime());
    catch(ParseException e){
         e.printStackTrace();
    %>
    But I am getting the following error message :
    Class jsp.myjsp.SimpleDateFormat not found.
    Please help me !!!.It's very urgent.
    Thanks,
    Savdeep

    programming is more then copy pasting, it actually is usefull to think about what you are doing. First you declare that you date is format dd-MM-yyyy, then you want to parse a date in format dd/MM/yyyy and behold Java warns you it cannot parse the one into the second ! Cant you solve the rest of this puzzle yourself then ?

  • To get the last 12 months from the input date

    Hi ,
    Is there any way in sql  to get the last 12 months date if i input the sysdate.
    LIke I will input sysdate (16-aug-13 ) and I need to get 16-jul-13,16-jun-13,16-may-13 like this.
    This has to be done in the sql only with out using pl/sql
    Regards,
    Papi

    select listagg(to_char(dt,'dd-mon-yy'),', ')
              within group (order by dt desc) dates
    from   (select add_months(date '2013-08-16',level*-1) dt
             from dual connect by level <=12
    DATES
    16-jul-13, 16-jun-13, 16-may-13, 16-apr-13, 16-mar-13, 16-feb-13, 16-jan-13, 16-dec-12, 16-nov-12, 16-oct-12, 16-sep-12, 16-aug-12

  • Remove $%&* characters from a String

    Hi,
    I have the following program that is supposed to detect a subsequence from a String (that contains $ signs) and remove it. This is a bit tricky, since because of $ signs, the replaceAll method for String does not work. When I use replaceAll for removing the part of the String w/ no $ signs, replaceAll works perfectly, but my code needs to cover the $ signs as well.
    So far, except for replaceAll, I have tried the following, with the intent to first remove $ signs from only that specific sequence in the String (in this case from $d $e $f) and then remove the remaining, which is d e f.
    If anyone has any idea on this, I would greatly appreciate it!
    Looking forward to your help!
    public class StringDivider {
         public static void main(String [] args)
              String symbols = "$a $b $c $d $e $f $g $h $i $j $k l m n o p";
             String removeSymbols = "$d $e $f";
             int startIndex = symbols.indexOf(removeSymbols);
             int endIndex = startIndex + removeSymbols.length()-1;
             for(int i=startIndex;i<endIndex+1;i++)
                  if(symbols.charAt(i)=='$')
                       //not sure what to do here, I tried using replace(oldChar, newChar), but I couldn't achieve my point, which is to
                       //delete $ signs from the specific sequence only (as opposed to all the $ signs)
             System.out.println(symbols);
    }

    A little modification on the last version:
    This one's more accurate.
    public class StringDivider {
         public static void main(String [] args){
              String symbols = "$a $b $c $d $e $f $g $h $i $j $k l m n o p";
                  String removeSymbols = "$d $e $f $g";
                  if(symbols.indexOf(removeSymbols)!=-1)
                       if(removeSymbols.indexOf("$")!=-1)
                            removeSymbols = removeSymbols.replace('$', ' ').trim();
                            removeSymbols = removeSymbols.replaceAll("[ ]+", " ");
                            String [] symbolsWithoutSpecialChars = removeSymbols.split(" ");
                            for(int i=0;i<symbolsWithoutSpecialChars.length;i++)
                                 symbols = symbols.replaceAll("[\\$]*"+symbolsWithoutSpecialChars, "");
                             symbols = symbols.replaceAll("[ ]+", " ");
                   else
                        symbols = symbols.replaceAll(removeSymbols, "");
              symbols = symbols.trim();
              System.out.println(symbols);

  • Remove Characters from a Date

    What are some ways that I could remove the hyphens, semicolons, periods, and empty strings from a date (in a single expression)?
    If I have a date (returned from GETDATE()) as follows:
    2014-09-15 16:53:09.253
    I want to remove the non-numeric characters and return this:
    20140915165309253
    Can REPLACE be used to identify more than one character pattern to replace?
    Thank you for your help!
    cdun2

    Another way, don't remove at all, begin with just the requisite dateparts and datenames. Although either way works fine, this way gives you absolute control over how you render.
    In this example, the "from sys.messages" is not part of the answer, I just included it to recreate a test to compare speeds.  It ends up having the same speed/execution plan/actual CPU time used either way. 
    The "Right()" functions are required, because for example, if the time is 8:03, the "03" is presented as just "3", so you have to force it to render as "03" with the Right function.  The DatePart(month) is the
    only one returning an integer result, so that must be cast as Varchar, the DateName() functions return a string, although unfortunately with leading zeroes removed.
    Select Datename(year, SysDateTime())
    + Right('0' + Cast(DatePart(month, SysDateTime()) as varchar(2)) , 2)
    + Right('0' + DateName(day, SysDateTime()), 2)
    + Right('0' + DateName(hour, SysDateTime()), 2)
    + Right('0' + DateName(minute, SysDateTime()), 2)
    + Right('0' + DateName(second, SysDateTime()), 2)
    + Right('0' + DateName(ms, SysDateTime()), 3) , sysdatetime()
    from sys.messages sm1
    Select REPLACE(REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR(30), GETDATE(), 121),'-',''),':',''), '.',''),' ',''), sysdatetime()_
    from sys.messages sm1

  • APEX4: How to create a report whose data is based on user input date fields

    Using Apex 4 I've to create a report that allows the user to input two date and shows a report between the date range.
    How can I do this?
    Thank you.

    This has nothing to do with apex 4.0. If you create a report using this query:
    SELECT *
      FROM emp
    WHERE hiredate BETWEEN NVL (TO_DATE (:p1_date_from, 'mm/dd/yyyy'), hiredate)
                        AND NVL (TO_DATE (:p1_date_to, 'mm/dd/yyyy'), hiredate)and create two date picker items with names P1_DATE_FROM and P1_DATE_TO (take care of using the right date format), your report will show all records by default and those that match after you fill in the date items.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • How to remove tooltips from more than one field at a time?

    I use the wizard and now there are more than 2000 fields with useless tooltips on each of them. How do I remove all the tooltips at once?

    Run this code from the JS console:
    for (var i=0; i<this.numFields; i++) {
        var f = this.getField(this.getNthFieldName(i));
        if (f==null) continue;
        f.userName = "";

  • Removing characters from a String

    Hi!
    I have a large String that has some unwanted characters in it that I want to remove. Here is an example:
    AA1lbmNvZGVkUGFy\015\012YW1zdAACW0JbABBlbm5MQ2Is there any method I can use to remove the characters \015\012 from the String. I looked at the method String.replace(char, char); but this is unsuitable because I can only remove one charater at a time an I may have this character occuring legitimately elsewhere in my String. Would it be possible in some way to traverse the String and identify the pattern of \015\012 and remove that.
    I'd appreciate any help,
    Thanks
    Chris

    Specifically,  str = str.replaceAll("\\\\01[25]", "");The replaceAll method is only available in v1.4.0 or later.

  • Remove or Change seconds in Date field

    Hello All,
    I have a field which is storing the start and end time. data type is date ( oracle 8.1.6). while the data is store into the table it is taking seconds also, but the requirement is to store only hours and minutes not seconds. for eg. if the time is '30/10/2007 10:30:59'. How to do this. ?
    regards
    Kris

    but the requirement is to store only hours and minutes not secondsThis doesn't sound like a requirement for storing the data but rather for retrieving or displaying the data. While yo can store the date with '00' seconds it might be more flexible to store the data with seconds and convert it later when you retrieve the data. Either way you can use one of the following;
    SQL> create table t as (
       select to_date('30/10/2007 10:30:59', 'DD/MM/YYYY HH:MI:SS') col1 from dual)
    Table created.
    SQL> select to_char(col1, 'DD/MM/YYYY HH:MI') || ':00' new_date
    from t
    NEW_DATE          
    30/10/2007 10:30:00
    1 row selected.
    SQL> select trunc(col1, 'MI') new_date
    from t
    NEW_DATE          
    30/10/2007 10:30:00
    1 row selected.

  • Remove characters from rightside

    In my query I select the following table
    ,pa_expenditure_items_all.ORIG_TRANSACTION_REFERENCE.
    The output gives values like
    12567245:2
    12567244:2
    12567247:3
    9367349:2
    9367349:4
    I would like to remove the last two positions in this output.
    However this proves to be, for me, more difficult then expected.
    The total number of characters varies so i can't use SUBSTR with counting starting from the left side.
    I tried REPLACE and TRIM but didn't get it right.
    Hope someone can help my out on this.

    Several methods are available:
    WITH pa_expenditure_items_all AS (SELECT '12567245:2' orig_transaction_reference
                                        FROM dual
                                       UNION
                                      SELECT '9367349:23'
                                        FROM dual
                                       UNION
                                      SELECT '79367349'
                                        FROM dual
    SELECT orig_transaction_reference
         , SUBSTR(orig_transaction_reference
                 ,1
                 ,DECODE(INSTR(orig_transaction_reference, ':')
                        ,0, LENGTH(orig_transaction_reference) + 1
                        ,INSTR(orig_transaction_reference, ':')
                        ) - 1
                 ) new_val_v1
         , REGEXP_SUBSTR(orig_transaction_reference
                        ,'^[^:]+'
                        ) new_val_v2            
      FROM pa_expenditure_items_all
    ORIG_TRANS NEW_VAL_V1 NEW_VAL_V2
    12567245:2 12567245   12567245
    79367349   79367349   79367349
    9367349:23 9367349    9367349C.

Maybe you are looking for

  • SQL DECODE function

    Oracle version: 9.2.0.1.0 Procob version: 9.2.0.1.0 Cobol version: 3.1.11 O.S. version: Windows XP We have a pro*cobol file with the next conversion rule into a select defined with a cursor. NVL(TO_CHAR(A.F_ALTA,'YYYYMMDD'),' '),      NVL(TO_CHAR(A.F

  • Issue while opening SSRS Report with Oracle as Datasource in Report Manager

    I deployed SSRS report in Report Manager but I am unable to generate that report. Am getting following error. Is it problem with datasource in report manager? I am not able to change the Data source type to Oracle. It is showing Microsoft SQL Server.

  • How can I see who made my Macbook Pro with Retina Display screen?

    Hello, I've read that the LG display burns into the screen. I've done the thing in Terminal "ioreg -lw0 | grep IODisplayEDID | sed "/[^<]*</s///" | xxd -p -r | strings -6" and all it says is Color LCD. Am I doing something wrong? Or does it not say?

  • How to upload morethan 999 line items for a document?

    if we need to upload more than 999 lines for a header. How can we do that?

  • Another Battery Query

    Hi, I've been reading through the posts for awhile now, and have tried all the Apple-recommended solutions to my battery problem (ie resetting it, etc), but nothing is working. I bought my mini brand new on October 1st 2005. Here is my story: - My ba