How To: Extract first three characters of a text field

Greetings --
What is the best method for extracting the first three
letters of a text field?
I need to extract the first three letters of a text field (in
this case Last Name),
so I add it to other components so as to create an
identification number for
a person.
This identification number that needs to be created is
comprised of the
person's date of birth, last 4 numbers of the social security
number and
the the first three letters of the person's last name.
Example:
==> Birthdate: 11/15/45
==> Last 4 SSN: 6654
==> Last Name: Smith
ID Number would be:
==> 1115456654SMI
Leonard B

That should do the trick:
I put your values in variable, just replace the names, as
needed
<cfset birthdate = "11/15/45">
<cfset ssn = "41646562121216654">
<cfset lastname = "Smith">
This deletes all the / from your birthday string (if it is a
string!) and puts it into the id variable:
<cfset id = replace(birthdate, "/", "", "All")>
This takes the last 4 letters/digits of your social security
number string and adds it to the id:
<cfset id = id & right(ssn,4)>
This takes the first thre letters/digits from your last name
variable, puts it in upper case and adds it to the id string
<cfset id = id & ucase(left(lastname,3))>
Hope it helps.

Similar Messages

  • Limit the amount of characters of a text field based on first digit

    Hello and thanks in advance for your help!
    I would like to limit the amount of characters of the text field based on the first digit of the number (the text field is only limited to a number format...no decimals, no commas).
    For example, if the number begins with a 3, I would like to limit the text field to allow only ten characters. I have three scenarios but if I could get started with some code and what is the best place to add it (keystroke or validation?) I can take it from there. Thanks again for your help!!

    I've written this code for you that does that. Use it as the field's custom Keystroke code:
    // Validate that only digits are entered
    if (event.change) {
        event.rc = /^\d+$/.test(event.change);
    // Validate string length if it starts with 3
    if (/^3/.test(AFMergeChange(event))) {
        event.rc = AFMergeChange(event).length <= 10;
        if (!event.rc) app.alert("If the number starts with \"3\" it may not be longer than 10 digits.",1); // optional error message
    You can duplicate the second part of it for additional conditions, but keep in mind that this code won't even let you remove the first character in the field if the result is an invalid one.
    For example, if you enter "234567890123456" then you can't remove the "2" at the start because that would result in an invalid number. You can remove any of the other digits, though, and when it's 10 digits or less then you could remove the starting "2" as well.

  • How to force all characters in prompt text field will be in uppercase???

    Hi everybody
    How to get that all characters in a prompt field of a Webi report will be compared in uppercase with the database field ?? Even if the user input text in lower case.
    this is due to the database all filelds are in uppercase, and avoid to say to the users they input fileds in uppercase.
    i looked for a parameter in a universe and in oracle.prm filed, and i didn´t find it.
    Thanks in advance
    Guillermo
    DB: ORACLE 10G
    BO: XI r2

    Thanks a lot rohy.
    now i use that solution, but my intention is try to solve to all objects, not each object individualy, due to i have a lot of objects that a user can choose from a prompt, and i have a lot of filters to do that
    i would like to change some parameter to do that at one time.
    i investigate about it......
    thanks again.
    best regards Guillermo
    have a nice day

  • How do I auto populate the date into text fields when form is first opened?

    Hello,
    I read all about the changing the scripts but its not really working for me. I was hoping someone could help me with directions on how to auto populate the date into designated text fields when my adobe document is first opened?
    I am working in Adobe Acrobat 9.
    Thank you,
    Sheri

    When you add a new document JavaScript (Advanced > Document Processing > Document JavaScripts > Script Name (enter something) > Add), you will be given a function skeleton by default. Just delete it and enter the line of code I showed above. Now, whenever the document is opened, the code will get triggered and the field will be updated with the current date. There is no "Document Open" action (at least that's accessible via Acrobat's UI), but this is effectively the same thing since any document-level JavaScripts are executed when the document is opened.

  • How does APEX check for null values in Text Fields on the forms?

    Hello all,
    How does APEX check for null values in Text Fields on the forms? This might sound trivial but I have a problem with a PL/SQL Validation that I have written.
    I have one select list (P108_CLUSTER_ID) and one Text field (P108_PRIVATE_IP). I made P108_CLUSTER_ID to return null value when nothing is selected and assumed P108_PRIVATE_IP to return null value too when nothign is entered in the text field.
    All that I need is to validate if P108_PRIVATE_IP is entered when a P108_CLUSTER_ID is selected. i.e it is mandatory to enter Private IP when a cluster is seelcted and following is my Pl/SQL code
    Declare
    v_valid boolean;
    Begin
    IF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NULL THEN
    v_valid := TRUE;
    ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NOT NULL THEN
    v_valid := TRUE;
    ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NULL THEN
    v_valid := FALSE;
    ELSIF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NOT NULL THEN
    v_valid := FALSE;
    END IF;
    return v_valid;
    END;
    My problem is it is returning FALSE for all the cases.It works fine in SQL Command though..When I tried to Debug and use Firebug, I found that Text fields are not stored a null by default but as empty strings "" . Now I tried modifying my PL/SQL to check Private_IP against an empty string. But doesn't help. Can someone please tell me how I need to proceed.
    Thanks

    See SQL report for LIKE SEARCH I have just explained how Select list return value works..
    Cheers,
    Hari

  • How can I limit numeric codes in a text field?

    How can I limit numeric codes in a text field? For example I want to list Industry SIC codes and I want to block someone from inputting an exlcuded industry code.

    We don't offer that type of input restriction for a text field. 
    Can you create a list of all allowed codes and use a Drop Down menu or Single/multiple Choice field? 
    Thanks,
    Josh

  • Char displaying only the first three characters in the cube

    Hi Experts
    I have a char  with lenth 60 and it's active.I am updating this char via the update routine whereby i am reading data from an active table of an ODS as i update in the update rules.
    But surprisingly,once the load is succesful and complete,upon checking the data in the active table it's displayin the way it should be the problem comes in when I view the data on the cube which displays only the first three chars even if the descriptionis a 60 character field.
    Please help

    Hi Herbert,
    Have you checked in the infosource or transfer rules, what is the length of the infoobject, if you are loading the data to PSA, please check there it self, whether it is displaying 60 characters or only 3 characters.
    Thanks
    Sat

  • How only show first n characters of field when fields are long

    I used to have a document on how to do this but lost it.
    How do I specify for a field to display the first so many characters in a given field when the field is too long to display in a table?

    sjurick wrote:
    Sorry, I'm using PHP, and MySQL.
    It depends if you want to either truncate the results from the select statement in the script,  or limit what is being returned by the select. You can use the php substr function
    http://www.php.net/manual/en/book.strings.php
    or the SQL Left() functions
    http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_left

  • How to delete first few characters from all the elements of an array of strings

    hi
    I have a 2-dimensional array of strings length 104. I have to delete first 6 characters from all the elements of array and then change the strings to int. how to do it?? plz help

    Attached you can find the screenshot showing how to do so.
    Bye!
    Licia
    Attachments:
    array.jpg ‏14 KB

  • How to restrict number of characters for an input field

    Hi All,
    I have an input field.
    The max number of characters for this input field is 10.
    when a user enter more then 10 characters. it should prompt for an error or the input field should not allow to accpet the 11 character.
    how we do this in VC.
    need your helpful answers
    Rgds
    Srinivas

    Hi Srinu
    You could achieve this by configuring error messages under the formula:-
    Select the control properties and in the Input field at the Display tab write the formula
    "IF((@<LEN(text)>10),'appropriate message','Records available')"
    Note :- there is a LEN(text) under text functions in formula tab.
    Regards
    Navneet
    Message was edited by:
            Navneet Giria

  • How can I do field validation on the last two characters of a text field?

    I have a text field. The user is required to enter the last two characters as numbers. I want to apply validation on this field. How can i achieve the same?
    EX: If the user enter ABCDE, an error messgae stating the last two digit should be numeric.
    I tried using the below in the field validation which did not work.
    (0+Right([<ExternalSystemId>],2)) > 0 AND (0+Right([<ExternalSystemId>],2)) < 99.
    Any ideas would help?

    Try this-
    FindOneOf(Right([<Field1>],"2"),"abcdefghijklmnopqrstuvwxyz")=0
    rgds,
    Amit

  • How to control numbers of characters in a input field?

    Hi all
    I need to limit the maximum of input characters to 255 in the field: vendortxt at the Shopping Cart. Do anyone know how to do this.
    Regards, Bjarne

    Hi,
      You can use the BBP_DOC_CHECK_BADI to read the number of characters entered in the text field VENDOR_TEXT and accordingly throw the error message if it exceeds 125 characters.
      In the BADI,use the FM BBP_PD_SC_GETDETAIL to read the details of the SC.In the table E_LONGTEXT,you wil get the value for Vendor text.
    BR,
    Disha.
    Pls reward points for useful answers.

  • How to  remove the Special characters like @,#,$ ,..from field

    How to  remove the Special characters like @,#,$<,..from text  field. we nedd to remove any specila char from text field .
    ex:text  = just#fi%cation@text
    the text should be justification.

    hi check this ..
    data:char(25) value '5#4#2#&1#&',
         char1(9) .
           replace all occurrences of '#' in char with 'and' .
           replace all occurrences of '&' in char with 'num' .
         write: char.
    or use this..
    data:char(25) value 'test@ing*5#4#2#&1#&',
         char1(9) .
           replace all occurrences of '#' in char with space .
           replace all occurrences of '&' in char with space .
           replace all occurrences of '@' in char with space .
           replace all occurrences of '*' in char with space .
         write: char.
    regards,
    venkat.

  • How can I combine three completed projects with text & sound to make one single movie?

    How can I combine three completed imovie 09 projects (They all have text & sound) to make one single movie? Thank you for any help you can give.

    If they are three separate projects than you will have to export all three as video files. Then you can reimport them into a new event, join them together as if they are ordinary clips, and export that.

  • How to extract a value from a dynamic form field

    Hello everybody!
    I created a field by the following command:
    htp.p(HTMLDB_ITEM.TEXT(1,'',20,30,'','VAL4','VAL5'));
    Then I created submit button.
    Question: In what way I can address to that value after I submit my page? Does anybody know?

    you'd be able to reference that value while your page is being submitted by pointing to the associated value captured in an array with something like...
    htmldb_application.g_f01(1)
    ...so you could do an...
    insert into my_table (my_col) values (htmldb_application.g_f01(1));
    ...to trap that value. but having said that, i don't know if you want to go that route. if you render an element using the htmldb_item api, that element's value won't be stored into session state. you can only get to it when you page is being processed/submitted (in an html db process, computation, or validation). if you really only just want one text field to display on your page, i'd strongly suggest just adding an html db Item of type "Text Field" to your page. that way you can refer to the value stored to that item from anywhere in your app. anyhow, you might already know that. getting back to your question, though, the htmldb_item items are stored to pl/sql varchar arrays when submitted to the html db engine. i explained that briefly in...
    Validations in Updatable Report
    ...(except i was calling the two api's wwv_flow_item and wwv_flow), and it's explained in better detail in our tabular form how-to document at http://otn.oracle.com/products/database/htmldb/howtos/tabular_form.html please do take a look and let us know if you need further assistance.
    regards,
    raj

Maybe you are looking for

  • Call Transaction In ABAP WDP

    Hi,             I Created a Transactional Iview for TC:PA20 in the Portal Content , In portal as well i was able to look into the preview of the transaction code PA20. I used the follwing code to navigate this Transactional IView in the ABAP WEBDYNP

  • These documents are too complex for the selected mode. Please select scanned documents and try again

    Getting this error message all of a sudden when i try to compare two documents in Acrobat 9 Pro. I work in Indesign with an annual report. Each time i make a new pdf i compare it with the previous version and it has been working fine until now. I hav

  • Send photos by mail

    I don't seem able to send annoys my photos via mail, after installing the iPhoto replacement, PHOTOS. When I select my photo from PHOTOS, then select the SHARE button at the top, it opens my options (Facebook etc), but my MAIL option is not available

  • Any security issues with My MSN or outlook bookmarks

    any security issues with My Msn and Outlook as bookmarks

  • ORA-01555 & ORA-00704

    After restoring a cold backup I tried to start the DB and got the below mentioned error, ERROR at line 1: ORA-01092: ORACLE instance terminated. Disconnection forced In alert log, ORA-00704: bootstrap process failure ORA-00704: bootstrap process fail