How to extract a number between () in a string

Dear All,
I have strings like the following:
DAC (450) DTO Ops (200) DMC (150) RMC (250)
BCA (50) RMC (200) DMC (60) DAC (870)  DTO Ops (1530)
DTO Arp (24.48) DTO Ops (173.8124) DM (5.7848)
I would like to extract selectively all DAC numbers assuming that the position of DAC number in the string is random but the number is always coming between () after "DAC" and 1 space.
Thanks
Regards
Ehfa Dil

Thanks Zack and Sanjay for your help! Really appreciated!
Hi Sanjay,
Your suggestion is working but I get errors when I have some database records with no "DAC " String
like this one: DTO Arp (24.48) DTO Ops (173.8124) DM (5.7848)
I have a 1 TB database with many similar records unfortunately... 
I am not good in programing but I am wondering if there is a script to avoid such errors. I have a workaround with Select expert in Crystal Reports but it is not convenient If I want to publish reports. Would be good if I can put (if expression or anything that could take such case out of errors) any ideas that could help?
Thanks Again
Regards
Ehfa Dil

Similar Messages

  • How I get random number between 1 and int number ?

    how can I get random number between 1 and int number
    like between 1 and 10 etc.
    10x

    Use the nextFloat() method of the Random class, this returns a random number between 0.0 and 1.0. To get and integer range from that multiply the return value of that method call by the integer range you need (in this case 10), and add the starting number you want returned in the range (1 in this case). The code below works for numbers 1-10.
    Random r = new Random();
    int x = (int)(r.nextFloat()*10) +1;

  • How to extract the number from image using java

    Hello every one
    i want to develope a project which can extract the number from image
    that i can use as inter or String or char.
    Is there any API in java which provide this type of facility.
    right now i m using java 5
    thanks in Advance
    Jignesh

    In my project i have a image in that i have a
    co-ordinate (x,y) I am still puzzled as to what you seek. It sounds to me like you have a point (x, y) represented by p. in java it's just p.getX() p.getY()
    i want to convert that cordinate to numeric form,
    i mena i want to use that cordinate in somewhere else
    in project.point.getX() point.getY()
    So need to convert it into numeric form u can called
    it OCR also.OCR is optical character recognition. If I want out and took a picture of the US Declaration of Independence and then wanted the words on the parchement in the picture in text form, then I would run the picture through a software program and it would try to optically recognise what lettering and number were present in the picture. In the end, I would have a text of what is written on the US Declaration of Independence.
    Is that what you want?

  • How to extract the number of the image which looks like a number

    Now,I can generate a image which contains a random number,but I can not extract the number of the image.Any one can help me?

    [url http://forum.java.sun.com/thread.jspa?threadID=779212&messageID=4433641#4433641]Crosspost.

  • How to extract row number of geoRaster as number ?

    Hi all,
    I need to get the row (or similarly column and band) number of a georaster as number. Some approach that i have explored :
    (a)
    Using SDO_GEOR.getSpatialDimSizes, which return an sdo_Number_array. For example SDO_NUMBER_ARRAY(211, 725) means 211 rows by 725 columns.
    But then how to get the 211 (or 725) as a number ? Any command for extracting the value ? substring clearly helpless.
    (b)
    Using metadata extract in PL/SQL. An example is
    create or replace function dimRaster
    (gr sdo_georaster)
    return number as
    total_dim number;
    begin
    total_dim := gr.metadata.extract('/georasterMetadata/rasterInfo/totalDimensions/text()',
    'xmlns=http://xmlns.oracle.com/spatial/georaster').getNumberVal();
    dbms_output.put_line('Total dimesnion'||CHR(9)||': '||total_dim);
    return null;
    end;-----------------
    The above works fine. It extracts the value in rasterInfo>totalDimensions as NUMBER. But the following isn't working:
    dim_row number;
    dim_row_Str := gr.metadata.extract('/georasterMetadata/rasterInfo/dimensionSize type="ROW"/size/text()',
    'xmlns=http://xmlns.oracle.com/spatial/georaster').getStringVal();
    I get the following error message
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00601: Invalid token in: '/georasterMetadata/rasterInfo/dimensionSize type="ROW"/size/text()'
    The number that i need to extract is in rasterInfo> dimensionSize type="ROW"> size.
    Please advise.
    cheers,
    =Damon

    Here is a function to do it. Since a function can only return one value, I created an object type for it.
    If this was going onto my production system, I would validate the metadata before running the procedure on a georaster object.
    Hope this helps:
    -- gr_dims object holds # rows, # columns, and # bands
    create or replace type gr_dims as object (
      r number,
      c number,
      b number);
    create or replace function georaster_size (geor sdo_georaster)
    return gr_dims deterministic is
    rowcols sdo_number_array := new sdo_number_array();
    result gr_dims := new gr_dims(null,null,null);
    begin
      rowcols.extend(3);
      rowcols  := SDO_GEOR.getSpatialDimSizes(geor);
      result.r := rowcols(1);
      result.c := rowcols(2);
      result.b := SDO_GEOR.getBandDimSize(geor);
      return result;
    end;
    select georaster_size(georaster) from map_rasters where georid=1;
    --GEORASTER_SIZE(GEORASTER)(R, C, B)
    --GR_DIMS(5117, 3748, 1)
    select g.gr.r, g.gr.c, g.gr.b
    from (select georaster_size(georaster) gr from map_rasters where georid=1) g;
    --      GR.R       GR.C       GR.B
    --      5117       3748          1

  • How to extract month number from a column in a table

    select extract(MONTH FROM DATE to_char(a.creationdate)) from mytable a doesn't work . plz tell me what is wrong with this. is there another way to get the month in a numeric form apart from this.

    Hi
    SQL> SELECT TO_NUMBER(TO_CHAR(TO_DATE('March', 'Month'), 'MM')) MONTH_NUM FROM DUAL;
    MONTH_NUM
    3
    SQL> SELECT TO_NUMBER(TO_CHAR(TO_DATE('December', 'Month'), 'MM')) MONTH_NUM FROM DUAL;
    MONTH_NUM
    12
    SQL> SELECT TO_NUMBER(TO_CHAR(TO_DATE('August', 'Month'), 'MM')) MONTH_NUM FROM DUAL;
    MONTH_NUM
    8
    This is what you want to do?
    Hope it helps
    Regards,
    Tony G.

  • How to extract the number of employees (Head count) in a particulr month

    Hi Experts,
    We are trying to have a customized report  on  Having the  employee  headcount  for a particular month  with number of employees joined on the month and number of employees left the organisation.What is the way to get it.
    Please advice.
    V Sai.

    Hi Vicky Sai,     
    The standard report is S_PH9_46000223 - EEs Entered and Left
    If you want to obtain the numbers in the same screen you should do the following1
    1 - access the report
    2 - further selection button - select Action type and move it to the Selection fields (you will get it on the screen)
    3 - select action Hiring and action Leaving (so that the report will only count these elements)
    4 - Period - current month
    5 - run the report
    6 - you will now have to see the number of employees (unfortunately you cannot do Sum here as you could do in a Querry that you would build as you would add the Count field so we need to do a little trick)
    7 - Change layout icon - View tab- select Preferred view instead of SAP List viewer ->Microsoft Excel
    8 - Select a template - press save
    9 - You will see now the report in the Excel format. You can do sums if you want, add formulas, or you simply delete the first line and just look at the latest line filled in (total number of EE who left or were hired during the month)
    If you do your own Querry - you can skip the Excel part and make a screen variant with the Sums.
    At least now you have 2 options that you can choose from
    Regards,
    Adriana

  • How to extract an element value from a String of HTML

    I have a web service that returns a fragment of HTML that contains a number in a table. The return parameter type is a string. I need to get this number and use it in a BPEL while loop, as the condition for the loop (while the number > 0).
    I have tried using the function bpws:getVariableData() but the BPEL PM faults and says: XPath expression failed to execute. Error while processing xpath expression. I think this is because I am trying to apply an XPath expression over a String variable.
    The return value from my web service looks like this:
    <whileConditionResultSet>
    <part xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" name="response">
    <ns1:string_Response xmlns:ns1="http://systinet.com/xsd/SchemaTypes/"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="d:string">
         <p>SQL Query: select count(*) from delta_manages</p>
         <p><table border='1'>
              <tr> <th bgcolor='#C0C0C0'>COUNT(*)</th></tr>
              <tr> <td>28</td></tr>
              </table>
         </p></ns1:string_Response>
    </part>
    </whileConditionResultSet>
    How do I get the value from the HTML table into a BPEL variable?

    the doSqlService() which executes an arbitrary SQL statement, returns a string of HTML like this:
    <doSqlServiceResponse>
    <part xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" name="response">
    <ns1:string_Response xmlns:ns1="http://systinet.com/xsd/SchemaTypes/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="d:string"><p>SQL Query: select count(*) from delta_manages</p> <p><table border='1'> <tr> <th bgcolor='#C0C0C0'>COUNT(*)</th></tr> <tr> <td>14</td></tr> </table></p></ns1:string_Response>
    </part>
    I then copy the result to the whileResultString variable
    <variable name="whileResultString" type="xsd:string"/>
    <copy>
                                       <from variable="doSqlServiceResponse" part="response" query="/ns1:string_Response">
                                       </from>
                                       <to variable="whileResultString"/>
                                  </copy>
    I realise too, a root element will be needed. This is not a mission critical problem as we could change the web service at the other end. It was originally designed for a client to display the results rather than use them within a business process. Anyway, I'm just interested to know if I can create a node from this string data in BPEL.
    Ross.

  • [CS3][JS] How to turn negative number in array into string

    Hello,
    I have a script that compares the array of the geometric bounds of all text frames to the margins for a document (all pages having the same margins). Any frames that do not match the margins are flagged.
    In order to compare the array of text frame geometric bounds to two arrays of margins (because they are facing pages), I have to convert the numbers to strings.
    My problem is that in the following snippet of code that creates the two margin arrays, the negative of the variables become numbers again. This would not be too difficult to solve except that all the numbers have to be 4 decimal points before converted to strings.
    Thanks,
    Tom
    var myDoc = app.activeDocument;
    var marginY1 = myDoc.pages.item(0).marginPreferences.top.toFixed(4);
    var marginX1 = myDoc.pages.item(0).marginPreferences.left.toFixed(4);
    var marginY2 = (myDoc.documentPreferences.pageHeight - myDoc.pages.item(0).marginPreferences.bottom).toFixed(4);
    var marginX2 = (myDoc.documentPreferences.pageWidth - myDoc.pages.item(0).marginPreferences.right).toFixed(4);
    var marginsRHand = [marginY1, marginX1, marginY2, marginX2];
    var marginsLHand = [marginY1, -marginX2, marginY2, -marginX1];

    Well, I think I have solved it. But I don't know why this solves it.
    I would think that in the above script all the variables would be numbers and not strings. But the data browser says they are strings.
    The solution is:
    var marginsLHand = [marginY1, Number(-marginX2).toFixed(4), marginY2, Number(-marginX1).toFixed(4)]
    If someone can explain why now all variables in the arrays are strings and not numbers, I'll be happy.
    Tom

  • How to count the number of times a string occurs in a column.

    I am listing team names in a column and want to have a tally at the bottom. In Excel I can use =SUM(IF(range="text",1,0)), but Numbers will not accept a range in that IF statement. ANy suggestions on a formula for his? I know I could create hidden columns and put formulas in all those and hen count them, but that sure seems like a heard way to resolve what should be one formula.
    THanks!

    Those which took time to read carefully *_iWork Formulas and Functions User Guide_* are aware of the availability of wildcard characters.
    =COUNTIFI(range;"=text")
    will do the trick.
    Yvan KOENIG (VALLAURIS, France) lundi 26 avril 2010 17:36:34

  • How to extract specific line from a string

    Hi guys.
    I?m starting to work with java...
    i have the following data inside a string variable:
    0 rows inserted.
    0 rows updated.
    0 rows ignored.
    98 rows marked as deleted.
    0 rows have no country.
    3345 rows have no geo.
    0 rows are invalid.
    what i want to do i to extract the number of rows marked as delete.
    I think that i figured out how to extract the number from this line :"98 rows marked as deleted."
    but how do i get to that line?
    I hope you can Help me. Thanks.

    the string is the result from a Function... this function gets the info from a store procedure...
                   rta = "Results for " + dh.getSource() + " source:\n" +
    dh.getInsertedCount() + " rows inserted.\n" +
    dh.getUpdatedCount() + " rows updated.\n" +
    dh.getIgnoredCount() + " rows ignored.\n" +
                   dh.getDeletedCount() + " rows marked as deleted.\n" +
                   dh.getNoCtryCnt() + " rows have no country.\n" +
                   dh.getNoGeoCnt() + " rows have no geo.\n" +
                   dh.getInvalidCnt() + " rows are invalid.\n";
    i can?t change this function...
    so i need to work with the returned value...
    i what thinking to use the following method to extract te number...
    private int GetNumericValue(string sVal)
    int iFirst, iCharVal, iEnd;
    int iMult = 1, iRet = 0;
    char[] aNumbers = "1234567890".ToCharArray();
    iFirst = sVal.IndexOfAny(aNumbers);
    iEnd = sVal.LastIndexOfAny(aNumbers);
    if (iEnd < 0)
    return 0;
    string subStr = sVal.Substring(iFirst, iEnd - iFirst + 1);
    iEnd = subStr.Length - 1;
    while (subStr.Length > 0)
    iCharVal = int.Parse(subStr[subStr.Length-1].ToString());
    iRet += iMult * iCharVal;
    iMult *= 10;
    if (iEnd <= 0)
    break;
    subStr = subStr.Substring(0, subStr.Length - 1);
    iEnd = subStr.LastIndexOfAny(aNumbers);
    subStr = sVal.Substring(iFirst, iEnd + 1);
    return iRet;
    but i still need the 4rd line to extract the number

  • How can I get extract the data between two cursors on an XY graph

    How can I get extract the data between two cursors on an XY graph

    Well, you say xy graph, so this might be a more complicated problem.
    For a waveform graph it's trivial. Simply get the two cursor indices (property: cursor index) and apply them to array subset of the data. Is that all you need?
    Here's how the above code would look like. using cursor.index instead of cursor.x elimnates the need to include scaling information.
    For an xy graph, there could be multiple segments (e.g. imagine a spiral that passes the desired x range multiple times from both sides). This would neeed significantly more code for a general solution.
    Message Edited by altenbach on 11-24-2009 07:53 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    cursorsubset.png ‏17 KB

  • How generate a random number that is between 0 and 15! (0-15)

    how generate a random number that is between 0 and 15 ??? (0-15)
    pls tell me, thx!!!!!!!!!!!!!!!!!

    import java.util.Random;
    Random r = new Random();
    int mynumber = r.nextInt()%16;
    For (2^1)-1 number use:
    -> int mynumber = r.nextInt()&15; // speedup

  • How do i put a loop round this so the user can only enter a number between

    how do i put a loop round this so that the user can only enter a number between 1 and 3 if a number like 4 is enter it will just say something like retry
    if (CA.trim().equals(ans1)){
    Out = "incorrect";
    else if(CA.trim().equals(ans2)){
    Out = "incorrect";
    else if(CA.trim().equals(ans3)){
    Out = "correct";
    else{
    System.out.println("Enter 1 2 or 3 try doin test again");
    System.out.println(Out);
    byte b[] = Out.getBytes();
    out1.write(b);

    You already know the conditions so here's some pseudocode.
    get input
    while(input is not what I want (between one and three))
            Inform user of improper input and ask for it again
            get new input

  • How to extract number from array?

    I'd like to extract some number from an array.For instance,there is an array {5,0,21,3,1,2,3,71,36},labview is expected to check if there is consecutive number in it.If is,the number before the first of the consecutive number and the one just after the last of the consecutive number are extracted,then they are put into another array. If not,nothing is done.In this array,1,2,3 are consecutive,then the number 3 and 71 will be put into another array.
    I thought about it for a long time but nothing came out.I am really at a loss now.Any help will be appreciated.An uploaded vi would be better.Thanks so much!!

    this may jus help you to get started... pls debug for error possible. You can have better solution.
    (and you got to figure out yourself of how it works as I was jus simply wire them up unitl it works )
    Cheers!
    Ian F
    Since LabVIEW 5.1... 7.1.1... 2009, 2010
    依恩与LabVIEW
    LVVILIB.blogspot.com
    Attachments:
    consecutive_check_example.vi ‏51 KB

Maybe you are looking for

  • Problem with GPS on Nokia Ovi Maps

    Hello everybody! I have a problem with GPS on my Nokia E90. Please can anybody help me with this problem. When i try to find my location using GPS with Nokia Ovi Maps the program show me a table like in the picture, but if i use Google Map the GPS wo

  • Repostings of data in profit centers

    Hi! any one can tell me can we report revenues between profit centers as we will done in the case of Cost Centers ( KB11N,KB61)? Not through distribution and assessment. I have configured some  revenue elements to internal order in OKB9 and in intern

  • Has anyone used this cool WebCam with a Mac yet?

    i'm in the market for a webcam for my new mac pro. i'm looking for the very best one out there. i ran into this WebCam called "aGent V4 HD". It looks awesome! Its a 3MP HD WebCam that comes with a desk mount and LCD mount. But its sold out of Austral

  • Fetch XML data stored in database table column dynamically

    Hi All, I am working as a SQL guy but never worked on XML in SQlbefore. During some project work , we need to fetch value from xml stored in database column. Problem is rowsof xml column arebit different and have different values. Could anybody help

  • Having problem with with Apple tv?

    I am having problem with wifi connection? can someone please help me out with this problem