Separating data combined in a string with a ";" delimiter

Post Author: debbethune
CA Forum: General
I have a couple fields from my file that contain data separated by a semicolon (AddOn and AddOnChg).  Field is formatted as a string.  How can I parse out the one component that has a value in order to be able to add up the values in the report? 
InvcNum          InvcDate          AddOn             AddOnChg
00113138        5/2/07              IFRTN;;;;          421.93;0;0;0;0

Post Author: SKodidine
CA Forum: General
You can use the split function, however if you want to know which component has a value, you might have to loop through the field.  Hopefully there are set number of separators for each field.
For example,
stringvar x := 'IFRTN;;;;'
split(x,';')[1] will give you IFRTN and split(x,';')[2] will give you empty field.

Similar Messages

  • Extracting part of a string with a delimiter

    Hi.  Is there a function that can take the string below, and extract EITHER everything to the left OR the right of the " | " separator?  I have many string fields with the same format and need to split them apart.  They all contain the same separator but I haven't come across anything that works.
    Thanks.
    "Communication  | 6. Invites feedback, discussion and/or suggestions about his/her own ideas and assumptions"

    Hi, 
    You can use the Split function.  This will convert your string to an array with a defined seperator like:
    StringVar myString;
    myString := "Communication | 6. Invites feedback, discussion and/or suggestions about his/her own ideas and assumptions"
    Split (myString, "|") [1];
    This will retrieve the first element in the array which is "Communication ". 
    Good luck,
    Brian

  • How to split a string with a delimiting regular expression like "\r"

    Hello!I am a fresh in java programming.Please don't deride my question.What I want to realize is to get the current caret lines and cols in a JTextPane. My question is :After I fetch the string content of the JTextPane and try to split it with the end-line token like "\r" or "\r\n",it always comes me an wrong position.
    here is my code:
    public void caretUpdate(CaretEvent e) {
    int ln,col;
    JTextPane textSource = (JTextPane)e.getSource();
    String sourceString = textSource.getText();
    String subString = sourceString.substring(0,
         (e.getDot() == 0) ? 0 : e.getDot()-1);
    String[] splitString = subString.split("\r",-1);
    ln = splitString.length;
    col = e.getDot() - subString.lastIndexOf("\r");
    setCaretPosition(ln,col); //display ln and col in a label
    I have got puzzled>_<.Please help me.Any help would be appreciated . (^-^)

    Swing text components always use "\n" to separate lines, not "\r" or "\r\n". When you read text in from a file or paste from the clipboard, the line separators are converted to "\n" if necessary. They save the info about what line separators were used in the source file, so if you write the text back to a file it converts them back.

  • Splitting a string with a delimiter

    Hi,
    Below are the lines of code in ABAP.
    v_gpdwstring(17)             TYPE c,
    v_afterdec(3)                TYPE c,
    v_beforedec(10)              TYPE c,
    SPLIT v_gpdwstring AT '.' INTO v_beforedec v_afterdec.
    The test value for v_gpdwstring = "1.53-"
    when the above SPLIT command is executed,
    v_beforedec is returning blank and v_afterdec is returning 53-
    Can anyone tell why v_beforedec is returning blank.
    Thanks

    Hello Radhika,
    When I look at this, it seemed ok.
    So I've tested like this:
    DATA:                                                    
    v_gpdwstring(17)             TYPE c,                     
    v_afterdec(3)                TYPE c,                     
    v_beforedec(10)              TYPE c.                                                                               
    break-point.                                             
    v_gpdwstring = '1.53-'.                                                                               
    SPLIT v_gpdwstring AT '.' INTO v_beforedec v_afterdec.   
    And the result was correct:  v_beforedec as '1', v_afterdec as '53-'.
    Can you re-check please? It seems ok...
    Kind regards,
    Bruno

  • Creating a string with hiearchical data

    This is being done in Crystal 8 will all updates applied.
    I have a database with records that are linked to a series of "folders" that are hierarchical in nature as shown below:
    Folder 1:
         Folder 1.1
              Folder 1.1.1
    Folder 2
        Folder 2.1
    All of the folders can have data records attached to them.
    The database represents the folder structure in a table with the following attributes:
    Folder ID   (integer)
    Folder Name (String)  (such as "Folder 1"
    Folder Parent ID (integer)
    (other non-related fields)
    If the folder is at the root level, then the value in Folder Parent ID is 0, otherwise, it is the Folder ID of the parent folder.
    I need to be able to create a string field that displays the path for any given folder that I can insert into a group header or footer, or into a report header if the report deals with records in a single folder.  Desired format for the  string is: 
    "Folder 1> Folder 1.1> Folder 1.1.1"
    I need to be able to display at least 6 levels of folder indentation.
    I have tried several ways to create a formula that will reliably produce the desired string, and can get close, but cannot completely address the problem.  My most successful approach was to put multiple instance of the table into the report and link the Folder Parent ID of one level to the Folder ID of the next level down and then use the data to build the string with a formula like this:
    Local StringVar Result := {portfolio_master.portfolio_name};
    local stringvar ExitLoop := "1" ;
    if  ExitLoop = "1" then
        Result := {portfolio_master_1.portfolio_name} + "> " + Result
    else
        ExitLoop := "0";
    if {portfolio_master_1.parent_id} NE 0 AND ExitLoop = "1" then  // NE replaces Crystal not equal symbol which will not show
        Result := {portfolio_master_2.portfolio_name} + "> " + Result
    else
        ExitLoop := "0";
    if {portfolio_master_2.parent_id} NE 0 and ExitLoop = "1" then
        Result := {portfolio_master_3.portfolio_name} + "> " + Result
    else
        ExitLoop := "0";
    if {portfolio_master_3.parent_id} NE 0 and ExitLoop = "1" then
        Result := {portfolio_master_4.portfolio_name} + "> " + Result
    else
        ExitLoop := "0";
    if {portfolio_master_4.parent_id} NE 0 and ExitLoop = "1" then
        Result := {portfolio_master_5.portfolio_name} + "> " + Result
    else
        ExitLoop := "0";
    Result;
    This formula works so long as the folder in question is exactly 5 levels deep.  Changing the nature of the links(inner join, left outer join etc.) between the instances of the table in the Database Expert changes the data that is visible, but I can't find a combination that will show ALL of the needed information for all of the folders. 
    I understand that this is a brute force approach, and that there must be a different way to skin the cat.  My preference would be to "walk the tree" with a loop structure, but I don't see any way to do the needed data look up within the loop.
    Any suggestions would be greatly appreciated!
    Thanks,
    L. Jasmann
    Edited by: ljasmann1 on Jun 23, 2010 9:09 PM
    Edited by: ljasmann1 on Jun 23, 2010 9:33 PM

    I have been working to adapt the code provided above to my application.  Although I have worked with Crystal for quite a while, this is the first time that I have attempted to use SQL in Crystal... and it is just not working.. probably because I am no doing something very basic.
    Here is  the code as currently set up in the SQL Formula Editor.  Only major difference from the code provided above is that the ID fields are integers instead of strings, and the field that I want to print out is a string field separate from the ID fields....  I have substituted the field names from the table I am referencing for the ones in the code above.  The table that I am using has been selected using the Database Expert.
    DECLARE @Value int, @pf int, @FolderPath VarChar(MAX)
    SET @Value = "portfolio_master"."portfolio_id"
    SELECT @pf = "portfolio_master"."parent_id" FROM portfolio_master WHERE "portfolio_master"."portfolio_id" = @Value
    SET @FolderPath = "portfolio_master"."portfolio_name"
    WHILE @pf <> 0
    BEGIN
    SET @Value = @pf
    SELECT @pf = "portfolio_master"."parent_id" FROM portfolio_master WHERE "portfolio_master"."portfolio_id" = @Value
    SET @FolderPath = "portfolio_master"."portfolio_name" + ' > ' + @FolderPath
    END
    SELECT @FolderPath AS FolderPath
    When I test the SQL statement it errors out on the very first statement (the DECLARE statement).  If I substitute a different statement in front of the DECLARE statement, it errors on that statement.
    Here is the error that I get back. The database is using MS SQL Server.
    Error in compiling SQL Expression:
    Failed to retrieve data from the database.
    Details:  ADO Error Code:  0x80040e14
    Source:  Microsoft OLE db Provider for SQL Server
    Description:  Incorrect syntax near the keyword u2018DECLAREu2019,
    SQL State:  42000
    Native Error:  156 [Database Vendor Code:  156].
    Any pointers would be greatly appreciated...
    Thanks,
    Larry Jasmann

  • How to extract string with delimiter

    Hello all,
    I'm using Oracle 10g and want to extract string with a delimiter.
    For example, i have aaaa;;bbbb;cccc;dddd;eeee;ffff and i want to extract this string into separates strings 'aaaa', ' ', 'bbbb', 'cccc', 'dddd', 'eeee', 'ffff'.
    Thanks a lots for yours help.
    MK.

    I prefer the regular expression method myself...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 'aaaa;;bbbb;cccc;dddd;eeee;ffff' as txt from dual)
      2  -- end of sample data
      3  select REGEXP_SUBSTR (txt, '[^;]+', 1, level)
      4  from t
      5* connect by level <= (select length(regexp_replace(txt,'[^;]*'))+1 from t)
    SQL> /
    REGEXP_SUBSTR(TXT,'[^;]+',1,LE
    aaaa
    bbbb
    cccc
    dddd
    eeee
    ffff
    7 rows selected.
    SQL>

  • How to create a String with comma ?

    Hi All,
    I have a table with 10 records(employee name) and i have to make a string
    with comma delimiter and at the end with "."
    Can anybody tell me how to write a Java program for this ?
    Thanks in advance.

    // I believe the following example gives you the answer.
    class stringEG {
         public static void main(String args[]) {
         String emprs[] ={"1","2","3","4","5","6","7","8","9","10"};
         String vempname = "";
         for(int i=0; i<emprs.length; i++) {
         if(i == (emprs.length-1))
              vempname = vempname + emprs[i] + ".";
         else
              vempname = vempname + emprs[i] + ", ";
         System.out.println("vempname : "+vempname);
    Here dont assume that I asked you to get all the results and putting
    it into the string arrays. But its a simple example to suit your requirement.
    The half-way coding below answers your question, I hope.
    vempname = "";
    while (emprs.next()) {
    if(emprs.isLast())
    vempname = vempname + emprs.getString("empname") + ".";
    else
    vempname = vempname + emprs.getString("empname") + ", ";
    // nats.

  • Crystal 2013 is casting a function with a date result as a string result, sometimes??

    I have an SQL Server function to take a JDEdwards numeric date and convert it to an SQL Date field. 
    CREATE FUNCTION [dbo].[date_ccyyddd_to_mmddyyyy]
      @JulianDate as Numeric(18,0)
    RETURNS Date
    AS
    BEGIN
    Declare @ResultDate as Date
    Set @ResultDate = DATEADD(YEAR, @JulianDate / 1000 + 1899, Cast('01/01/0001' as Date))
    Set @ResultDate = DATEADD(Day, @JulianDate % 1000 -1, @ResultDate)
    RETURN @ResultDate
    END
    In many query based reports we have used the function.  It works quite nicely for all but one user.  For this one user Crystal is casting the date result as a string, it will then display as a yyyy-mm-dd format instead of his default mm/dd/yyyy short date format.  It would generally be ok but since it is typed as a string if the user exports the results to excel it is not recognizing the column as a date either.  The strange piece of the equation is that if the user saves the report to the enterprise server and I open it, go to edit the SQL command, do nothing, close the edit box, it gives me the unmapped fields wizard where I can fix the report.  Thus when I open or generate a new report with this function it "knows" the result is a date but with a specific user it sees the result as a string.
    Has anyone had a similar situation or can lead me in the correct direction to fix this?  Unfortunately, this user is our power user, he writes more reports than anyone else.  It appeared as a problem when we upgraded from Crystal Enterprise 2008 to 2013.
    Current work around for user is to use a crystal CDate() function on the report side but I would like to get the correct solution.
    Any assistance appreciated,

    To add to Dell's suggestion:
    If OLE DB then use:
    MS SQL 2005 - OLE DB Provider
    MS SQL 2008 - SQL Native 10
    MS SQL 2012 - SQL Native 11
    MS SQL 2013 - SQL Native 11
    If ODBC then use:
    MS SQL 2005 - SQL Native
    MS SQL 2008 - SQL Native 10
    MS SQL 2012 - SQL Native 11
    MS SQL 2013 - SQL Native 11
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • Is it possible to combine a address list with a Pages document and a data base in Numbers, the equivalent of "Mail Merge" using Microsoft?

    Is it possible to combine an address list with a Pages 5.1 document and a data base in Numbers 3.1, the equivelent of Microsoft "Mail Merge"?

    It is possible in Pages 09 and Numbers 09 but not in the versions you name.

  • Updating an oracle table with data from an xml string

    Hi - I need help with the following problem:
    We have a table in the database with a field of xml type. We are going to take each string that gets inserted into the xml type field in the 'xml table' and parse the data into another oracle table with corresponding fields for every element.
    once the record gets inserted into the 'real table' the user might want to update this record they will then insert another record into the 'xml table' indicating an update(with a flag) and then we need to update the 'real table' with the updated values that have been sent in.
    The problem that I am having is that I do not know how to create this update statement that will tell me which fields of the table need to be updated.(only the fields that need to be updated will be in the xml string in the 'xml table').
    Please help me with this - ASAP!

    Are you wanting to upload the file through an Oracle Form or just upload a file? If it isn't via forms, then you should probably post your question here: {forum:id=732}
    You also should post the version of Forms, Database, etc...
    As far as uploading files via a text file, I personally like to use Oracle External Tables even in Forms. You can Google that and there is plenty of information. If you search this forum, then you will see lots of people use UTL_FILE in forms, but you can Google that also for more information.

  • Set my wifes account up with mine.  Now all our data combines.  How do I set up an account just for her so we don't share all our contacts and such??

    Set my wifes account up with mine.  Now all our data combines.  How do we set up her own account so we don't share all contacts and such??

    There is only one solution. Each user must have their own separate user account. All of their respective data would be contained in their separate user accounts. This also means each will have a separate iTunes Library. If you all use the same third-party apps, then each will have to purchase their own copies under their own Apple IDs. Some data sharing is possible. See:
    iTunes- How to open an alternate iTunes Library file or create a new one
    iTunes- How to share music and video
    iTunes- How to share music between different accounts on a single computer
    iTunes- Setting up Home Sharing on your computer

  • Data written to excel string is text rather than double when opened in excel

    I have code that combines a time string, numerous double arays and a couple of individual doubles. All seems to work well except when I open the created data file in excel, the first cell after the time string is always a string and not numeric. This is the first value in a double aray and all the other elements of the array are correctly converted to numbers. Only the first element is being interpreted incorrectly. This is messing up an other wise nice spreadsheet.
    Any thoughts?
    Solved!
    Go to Solution.
    Attachments:
    WriteRecord.png ‏43 KB

    The problem is Excel.  When Excel gets a text file, it isn't actually opening the file, it is importing it.  It has default settings it uses for how to parse the data.  It seems to have no problem recognizing a tab as a cell separator, but it doesn't recognize a comma has a cell separator.  In older Excel, you could do a File/Import, and you'd have to intentionally check the checkbox for a comma to be a delimiter.
    I really think Microsoft was pretty stupid on this point.  Excel recognizes CSV as a file type to import.  CSV stands for Comma Separated Values.  Yet Excel doesn't treat the comma as a separator.
    Do you have to use a comma as a separator, or can you use a tab?
    Your code is kind of convoluted (as pointed out by others).  Your combining string manipulations with array to spreadsheet string making a comma has a delimiter, then building an array, then writing that 2 column array to a file using Write to Spreadsheet file where now the tab is your delimiter.  That is why the first column sort of works.  Excel understands the tab.
    That whole section of code really needs to be rewritten and use a consistent format.

  • How to concatenate a string with single quotes

    Hi all,
        how to concatenate a string with single quotes to a variable.
    Sathya

    Hi sathyabama,
    1. simple
    2. use TILDE character <b>(`)</b>
       (just left to the '1' key)
    <b> `'mystring'`</b>
    3. just copy paste
    report abc.
    data : m(100) type c.
    concatenate `'amit mittal'` 'hello' into m separated  by space.
    write m.
    regards,
    amit m.

  • My colleague and I are working together (from separate MacBooks) to create an iBook for our students. We plan to work on sections separately and combine later. Must we use the SAME template to do so?

    My colleague and I are working together (from separate MacBooks) to create an iBook for our students. We plan to work on sections separately and combine later. Must we use the SAME template to do so?

    I'm not sure iBA reacts well to this type of editing, not to mention the cumbersome nature of trying to bring everything together in general.
    I'd suggest a workflow where one book is handed off, instead. That, or, let the individuals involved create their basic content in Pages, then when ready, use iBA's Insert Pages Chapters menu to string them together. Best to work in a linear fashion and avoid adding/removing/adding/moving portions, etc.
    If you must have separate authors, be sure to use the identical template and have them all properly trained up before going forward - trying this as a learning experience may result in an off-putting experience otherwise , with more time spent on chasing knots than on expressing writing skills, etc.

  • Comma separated data to array

    I am looking for a method to translate a string with comma separated data into an array or vector.

    Hello rolivawdaneel, I hope this help you, this takes the string a returns a vector.
    import java.util.StringTokenizer;
    import java.util.Vector;
    public class stringConverter {
        public static Vector toVector( String s ) {
            Vector result = new Vector();
            StringTokenizer st = new StringTokenizer( s, "," );
            while( st.hasMoreTokens() ) {
                String aTokenizedString = st.nextToken();
                result.addElement( aTokenizedString );
            return result;
    }

Maybe you are looking for

  • When I print to pdf on Mac, the first page comes out fine but all the rest are magnified and shifted up and right

    I click File>Print. Whether I open pdf in Preview, save to pdf, or just print, I get this error. The first page is fine, but all the rest are shifted up and to the right and magnified. I've never been able to print out a multi-page document on Firefo

  • Several photo applications won't work

    I upgraded from Leopard to 10.6.6 on my 2007 MacPro the other day, just after adding an ATI Radeon 5770 graphics card to feed an Apple 27" LED Cinema Display. Everything seemed to work fine until I tried running some photo and printing apps. Then I d

  • Vendor Update log capturing

    Hi all i pulled some vendors from ECC into SRM one month back and i wanted to know  who and all modified my vendors data in SRM by maintain business partner menu. i want a list who changed /data changed in the vendors in SRM . i believe there is no s

  • HTTP 404 Error on submit

    I am generating an APEX application page 'region' as a PL/SQL anonymous block using the htp.p function. The PL/SQL htp.p dynamically creates radio groups, text links, and buttons from database data. It appears that if the generated page is too big (t

  • Remove Oracle

    Hi , How can I remove Oracle S/W and Database completely from Windows and Linux machines. Thanx in advance.