Help needed in extracting pipe delimited fields in a CLOB data type

hi
i Had a table with clob field as shown below.
CREATE TABLE TRANSACTION_INFO
  TRASACTION_ID  CLOB,
  LOG_ID  NUMBER
Insert into TRANSACTION_INFO
   (TRASACTION_ID, LOG_ID)
Values
   ('354502002020910|000000610214609663||09/27/09 08:02:37|RNEW|DC25|MOTOROLA|8802939198', 123);
Insert into TRANSACTION_INFO
   (TRASACTION_ID, LOG_ID)
Values
   ('354599892020910|000000610214609663||09/27/10 08:12:47|SOLD|DC23||8802939198', 456);
COMMIT;As you can see Clob field is a pipe delimited data.Now i am able to extract the first two fields using the below querry.But it may be the right solution as
substring function fails if there is missing character in any on the fields.
Also when there is a null value in any of the fields,how can i be able to get as null value ? Basically i want to get the values in a delimited manner.
how can we do this ?
Select Substr (TRASACTION_ID, 1, Instr (TRASACTION_ID, '|')-1) field1,
        Substr (TRASACTION_ID, 17, Instr (TRASACTION_ID, '|')+2) field2              
  From TRANSACTION_INFO;
output should be like as shown
   FIELD1          FIELD2          FEILD3                 FEILD4
354502002020910     000000610214609663                  09/27/09 08:02:37
354599892020910     000000610214609663                  09/27/10 08:12:47Thanks
Rede

hi Michael
Thanks for the solution and its my bad not mention that there is a possibility of having a null value at the start of the record also which RPLACE function no longer works for this case.
For example
with transaction_info (trasaction_id, log_id)
     as (
select '354502002020910|000000610214609663||09/27/09 08:02:37|RNEW|DC25|MOTOROLA|8802939198', 123 from dual union all
select '354599892020910|000000610214609663||09/27/10 08:12:47|SOLD|DC23||8802939198', 456 from dual union all
select '|000000610214609663||09/27/10 08:12:47|SOLD|DC23||8802939198', 456 from dual
select trim(regexp_substr (trasaction_id, '[^|]+', 1, 1)) f1,
       trim(regexp_substr (trasaction_id, '[^|]+', 1, 2)) f2,
       trim(regexp_substr (trasaction_id, '[^|]+', 1, 3)) f3,
       trim(regexp_substr (trasaction_id, '[^|]+', 1, 4)) f4,
       trim(regexp_substr (trasaction_id, '[^|]+', 1, 5)) f5
  from (select replace (trasaction_id, '||', '| |') trasaction_id from transaction_info)
F1                   F2                   F3                   F4                   F5                 
354502002020910      000000610214609663                        09/27/09 08:02:37    RNEW               
354599892020910      000000610214609663                        09/27/10 08:12:47    SOLD  
000000610214609663                        09/27/10 08:12:47    SOLD Now the last record is wrongly created....

Similar Messages

  • PLEASE HELP!!!  Problem with Java and SQLServer Text data type

    Hi there,
    I have a java app. that reads from an MS SQLServer database. Originally, all long text fields were declared as NVARCHAR(200). The program worked fine.
    Someone then advised that I change all long text fields to the TEXT data type. The program now crashes out with the following Exception:
    "java.sql.SQLException: [JRun][SQLServer JDBC Driver]This ResultSet can not re-read row data for column 25."
    Basically, I have a method that retrieves a resulset and iterates through it. The resultset is passed to another method during each iteration. In the example below, the 'specialNote' field used to be NVARCHAR(200). The code worked fine. Then when it was changed to TEXT, the program no longer works with the above Exception thrown.
    Anyone know any special way SQLServer TEXT data types need to be handled?
    Thanks for any advice!
    The code looks something like this in functionality:
    <CODE>
    public void method1 (Connection conn)
    Resultset rs = conn.createStatement().executeQuery("SELECT * FROM ProductBB");
    while (rs.next())
    method2(rs);
    public void method2 (ResultSet rs)
    String str = rs.getString("specialNote");
    </CODE>

    Hi JWoods,
    Thanks for the suggestion. I originally had the code do what you suggested, ie, get the resultset then retrieve the data all within the same method. The data is then used to set properties in an object.
    When I had to create another method that also retrieved a resultset but using a different primary key, then also use the returned data to set the properties in the same type of object, I didn't want to repeat the setter code. That's why I decided to pass the resultsets to the same method that did the property setting.
    Unfortunately, it stopped working with the data type change.
    Any other thoughts?

  • Oracle BI Administration Tool 11g - Fields have the XML data type

    I'm using Oracle BI Administration Tool 11.1.1.3.0 and I need to import Metadata an Oracle table where same fields have the XML data type.
    Please, there is someone can tell me what I must do to define these fields in Administration Tool?
    Regards.

    Hi,
    in u r RPD -->Try to select import Connection Type as : XMLA then give it the URL of u r analysis services 2000 then u can able to import it.
    refer:
    http://www.biblogs.com/2008/02/01/obiee-hybrid-olap-reporting-using-ms-analysis-services-oracle/
    http://www.rittmanmead.com/2007/11/essbase-integration-with-obiee-101331/
    Thanks
    Deva

  • Help: need to extract an application from oracle/apex directory

    Hi, all!
    I worked on oracle10xe and apex 1.3.1 and then messed with partition table a bit so got my windows crashed and I don't believe i'll be able to restore it.
    so what i have is an oracle directory from the long-dead windows with apex inside, and i need to extract the applications and the data i was working with somehow.
    Any thoughts?
    Does anybody knows where does oracle store all its databases and where apex keeps its applications?
    oraclexe\oradata\xe\ has some .dbf files in it, will it work if i just write them over in a newly installed oracle+apex?

    Hello,
    At this point, since you can't turn to Oracle Support (since it is XE), then I would suggest asking amongst your colleagues/friends/etc and trying to find a friendly DBA who will try and help you out for a beer or 3.
    Depending on how critical your work was, I wouldn't throw away all hope of recovering your database until you've exhausted all the options.
    John.
    http://jes.blogs.shellprompt.net
    http://www.apex-evangelists.com

  • The difference between FIELD-SYMBOL and normal DATA TYPE

    Dear experts,
    Please see the example below, both are output the same result.
    DATA: EXTERNAL_RECORD(4000),
          POSITION TYPE I,
          LENGTH TYPE N,
          ENTRY TYPE STRING.
    EXTERNAL_RECORD = '0005Smith0007Edwards0005Young'.
    DO.
      LENGTH = EXTERNAL_RECORD+POSITION(4).
      IF LENGTH = 0.
        EXIT.
      ENDIF.
      ADD 4 TO POSITION.
      MOVE EXTERNAL_RECORD+POSITION(LENGTH) TO ENTRY.
      WRITE ENTRY.
      ADD LENGTH TO POSITION.
      IF POSITION >= 4000.
        EXIT.
      ENDIF.
    ENDDO.
    --OR It can be written as--
    DATA: EXTERNAL_RECORD(4000),
          POSITION TYPE I,
          LENGTH TYPE N.
    FIELD-SYMBOLS <ENTRY>.
    EXTERNAL_RECORD = '0005Smith0007Edwards0005Young'.
    DO.
      LENGTH = EXTERNAL_RECORD+POSITION(4).
      IF LENGTH = 0.
        EXIT.
      ENDIF.
      ADD 4 TO POSITION.
      ASSIGN EXTERNAL_RECORD+POSITION(LENGTH) TO <ENTRY>.
      WRITE <ENTRY>.
      ADD LENGTH TO POSITION.
      IF POSITION >= 4000.
        EXIT.
      ENDIF.
    ENDDO.
    Is there any special circumstances we need to use FIELD-SYMBOL?
    Why is FIELD-SYMBOL is introduce in the first place?
    Kindly advice with example.
    Thanks in advance for those who can help me on this.

    HI,
    You can use field symbols to make the program more dynamic. In this example the name of a table control is substituted by a field symbol. Thus you cal call the form with any internal table, using the name of the table control as a parameter.
    Example
    form insert_row
    using p_tc_name.
    field-symbols <tc> type cxtab_control. "Table control
    assign (p_tc_name) to <tc>.
    insert 100 lines in table control
    <tc>-lines = 100.
    Field symbols allow you to:
    **     Assign an alias to a data object(for example, a shortened
            name for data objects structured through several hierarchies
            - <fs>-f instead of rec1-rec2-rec3-f)
    **     Set the offset and length for a string variably at runtime
    **     Set a pointer to a data object that you determine at runtime (dynamic ASSIGN)
    **     Adopt or change the type of a field dynamically at runtime
    **     Access components of a structure
    **     (from Release 4.5A) Point to lines of an internal table
            (process internal tables without a separate work area)
    Field symbols in ABAP are similar to pointers in other programming
    languages. However, pointers (as used in PASCAL or C) differ from ABAP
    field symbols in their reference syntax.
    The statement ASSIGN f to <fs> assigns the field f to field
    symbol <fs>. The field symbol <fs> then "points" to the
    contents of field f at runtime. This means that all changes to the
    contents of f are visible in <fs> and vice versa. You declare
    the field symbol <fs> using the statement FIELD-SYMBOLS: <fs>.
    Reference syntax
    Programming languages such as PASCAL and C use a dereferencing symbol
    to indicate the difference between a reference and the object to which
    it refers; so PASCAL would use p^ for a pointer instead of p, C would
    use *p instead of p. ABAP does not have any such dereferencing symbol.
    **     In PASCAL or C, if you assign a pointer p1 to a pointer p2,
    you force p1 to point to the object to which p2 refers (reference semantics).
    **     In ABAP, if you assign a field symbol <fs1> to a field
    symbol <fs2>, <fs1> takes the value of the data object to
    which <fs2> refers (value semantics).
    **     Field symbols in ABAP are always dereferenced, that is,
    they always access the referenced data object. If you want to
    change the reference yourself in ABAP, you can use the ASSIGN statement
    to assign field symbol <fs1> to field symbol <fs2>.
    Using field symbols
    You declare field symbols using the FIELD-SYMBOLS statement.
    They may be declared either with or without a specific type.
    At runtime you assign a field to the field symbol using the ASSIGN
    statement. All of the operations on the field symbol act on the field
    assigned to it.
    When you assign a field to an untyped field symbol, the field symbol
    adopts the type of the field. If, on the other hand, you want to assign
    a field to a typed field symbol, the type of the field and that of the
    field symbol must be compatible.
    A field symbol can point to any data object and from Release 4.5A,
    they can also point to lines of internal tables.
    The brackets (<>) are part of the syntax.
    Use the expression <fs> IS ASSIGNED to find out whether the field
    symbol <fs> is assigned to a field.
    The statement UNASSIGN <fs> sets the field symbol <fs> so
    that it points to nothing. The logical expression <fs>
    IS ASSIGNED is then false. The corresponding negative expression
    is IF NOT <fs> IS ASSIGNED.
    An unassigned field symbol <fs> behaves as a constant with
    type C(1) and initial value SPACE.
    MOVE <fs>
    TO dest     Transfers the initial value SPACE to the variable dest
    MOVE 'A' to <fs>     
    Not possible, since <fs> is a constant
    (runtime error).
    To lift a type restriction, use the CASTING addition in the
    ASSIGN statement. The data object is then interpreted as though
    it had the data type of the field symbol. You can also do this
    with untyped field symbols using the CASTING TYPE <type> addition.
    The danger with pointers is that they may point to invalid areas.
    This danger is not so acute in ABAP, because the language does not
    use address arithmetic (for example, in other languages, pointer p
    might point to address 1024. After the statement p = p + 10, it would
    point to the address 1034). However, the danger does still exist, and
    memory protection violations lead to runtime errors.
    A pointer in ABAP may not point beyond a segment boundary. ABAP does
    not have one large address space, but rather a set of segments.
    Each of the following has its own segment:
    *     All global data
    *     All local data
    *     Each table work area (TABLES)
    *     Each COMMON PART
    You should only let field symbols move within an elementary field or
    structure where ABAP allows you to assign both within the global data
    and beyond a field boundary.
    Rgds
    Umakanth

  • How could I Write data into a field in Oracle whose data type is VARCHAR2

    The target data I want to write into Oracle is in http://tw.yahoo.com/info/utos.html.
    Now, these data is stored in Mysql database and the field which stores these data uses "Text" as its data type.
    I want to derive these data from mysql database and store them into a field of oracle database.
    In oracle, I create field whose data type is varchar2(4000) to store these data.
    I use JSP to derive data from mysql and insert into oracle through JDBC.
    But the result of the page shows me that "javax.servlet.ServletException: Data size bigger than max size for this type: 25623".
    Please anyone could help to resolve this problem?
    Thank you very much.

    My hunch is that the problem is that VARCHAR2(4000), but default, allocates 4000 bytes of storage. Depending on your database character set, a single character may require up to 4 bytes of storage.
    If you are on 9i, you can declare the column VARCHAR2(4000 CHAR) to allocate 4000 characters of storage. You can also set NLS_LENGTH_SEMANTICS to CHAR, which will cause Oracle to assume that your declarations are in characters rather than bytes.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • What needs to be done in OBIEE 11g when underlying data types change?

    I have an SQL table that I am referencing. It contains several date fields that were varchar(8). In order to do calculations, I just cast the fields as date, and performed my calculation.
    Recently, the DBA changed the fields to date type.
    I did a "View Data" and "Update row count", but it seems as if OBIEE is still treating the fields as varchar fields.
    What is the proper procedure in OBIEE 11g to recognize the changes that occurred in the underlying table?

    Hi
    In your scenario, I can suggest you can change manually to  each field lengths in physical layer.
    If you really looking one time fix then try to import the new table stricture into new rpd then save it then try to  merge original rpd . – But it is risky process ( We have two methods, patch merge and fully repository merge).
    Before doing above method take the backup original rpd and do it in your local.
    Thanks,
    Satya Ranki Reddy

  • Database fields importing as wrong data type

    I am using Crystal Reports 2008, connecting to an Oracle 9i database. 
    Some of our database tables have a field with data type of SDO_GEOMETRY.  I know this is an unsupported data type in CR, so the field list in the field explorer skips over it when I import tables using the Database Expert.  However, it doesn't skip over the data type, giving each field below the SDO_GEOMETRY field the wrong type.  To illustrate:
    Field Name     Type (Size)
    GEOLOC          SDO_GEOMETRY (1)
    ID          NUMBER (22)
    NAME          STRING (25)
    DESC          STRING (200)
    CR 2008 will skip GEOLOC, assign ID as String (2000)how it interpreted SDO_GEOM in ver. XIName as Number, and Desc as String (25).  I also noticed this behavior in CR XIR2.  Has anyone else run into this?  The workaround I've found is to write a SQL command; but is there a setting or hotfix out that fixes the bug?

    Hello,
    I would recomend using a stored procedure to connect to the data and assign a Crystal-valid data type to each field so that there won't be a chance for this sort of issue to happen when pulling in data.
    -Sean

  • Need a query to retrive reocrds from a blob data type!

    Hi,
    I need a sql query to check in a cloumn which is a blob data type ,where the column stores the XML values and the query should check a particular value in the column if value is there it shud return with yes or no.

    Thanks for your reply...
    Let me clearly explain my need.. for instance a table xyz and in that we have 5 columns but based on some conditions on 3 columns i need to retrive the records..like..
    select * from xyz where a=** and b=** and c=***; here i need to pass the values of a,b and c while runtime only and not as static values and also i need to return with a message like records found,not found based on the condition where the particular record for the column C is there or not there.

  • Metadata Field -- List of Strings -- Data Type

    I'm trying to create a dropdown List to create a custom Metadata . i saw that the data type "list of strings" is available on already created metadata , but once i try to create a custom metadata list I can find the List of Strings datatype . did i missed something when i installed FCS?
    is this possible.
    I wish i could add a keyword dropdown list, as we can do with booleans but of course with more than 2 choices.

    Sorry, since the french translation of the manual is not crystal clear, i didn't know i had to use the lookup feature. i jsut bought Getting Started with Final Cut Server (Matthew Geller - PeachPress ed.) where i got the final answer.
    anyway, it's not very handy because it would be easier to unlock the List of Strings darta type to create a new metadata field.
    i'm a newbie sorry again.

  • Help needed to validate a text field

    I'm using Acrobat X1 Pro and Live Cycle Designer ES4
    I have a numeric text field to capture a blank or 14 digit number.
    The display pattern is: null{}|num{zzzzzzzzzzzzzz}
    The edit pattern is: null{}|num{zzzzzzzzzzzzzz}
    The validation pattern is:
    The data pattern id : null{}|num{zzzzzzzzzzzzzz}
    I'm trying to make test that the user:
    only enters numbers
    enters nothing or a 14 digit number.
    Display an error message and set focus back on the field for wrong entries.
    This is the code:
    topmostSubform.Page1.AU01::exit - (JavaScript, client)
    // Test AU number format
    var re = /^[0-9]{14}$/
    //Allow blank space in field
    if (event.value !="") {
      if (re.test(event.value) == false) {
        app.alert ({
           cTitle: "Incorrect AU Format",
           cMsg: "Enter a valid 14-digit AU number."
         getField("AU01").setFocus);
    I get the error message when I exit the field regardless of what is in the field. And the set focus does not seem to work.
    I can program in VBA but find Javascript challenging. What good reference books can you recommend?
    May thanks.
    Brian Dunkin

    Hi,
    With the first issue: having the dropdown and the first textfield displaying the same value, the easy solution is to use Global Binding.
    Make sure that the dropdown and the first textfield have the same name in the hierarchy.
    The select one of them and in the Object > Binding palette, set the binding to Global.
    In the dropdown go to the Object > Binding palette and make sure that "Specify values" is NOT ticked.
    It is probably a good idea to set the textfield to read only, in the Object > Value palette. This would prevent the user overwriting the value set by the dropdown.
    No script required. Whatever is in the dropdpwn will appear in the textfield.
    The second issue needs a small script in the calculate event of the second textfield. This looks at the value in the first textfield (TextField1) and sets its own value. This is JavaScript:
    if (TextField1.rawValue == "Option B")
         this.rawValue = "Specific text";
    else
         this.rawValue = null;
    There are some examples here: http://assure.ly/jtTkdO, http://assure.ly/fYCuQ2.
    Hope that helps,
    Niall

  • Help needed on adding 2 new fields.

    Hi gurus,
    I have a existing data model which is from the flatfile to ods to cube. The new user requirement is for 2 new fields which would be based on a existing field that is already there in the data model. the change is going to be based on a existing field that is field A.
    The user have now provided with a new flatfile which is a lookup table, this flatfile this flatfile relates the existing field A with new fields Field B and C. the way in which the fields A,B and C are related are Field A is the lowest catagory in the hierarchy and field B is a sub catagory and Field C is the main catagory.
    i need to bring in these 2 new fields can out there help me out on how to handle this scenario. the lookuptable they have provided me is static and it is a flatfile table.
    FIELD A FIELD B FIELD C
        A                  A1            B1
        B                    A1           B1
        C                   A1            B1
        D                   A2            B1
        E                   A2            B1
        F                   A2            B1
       G                    A3            B2
       H                    A3             B2
    Points will be given.

    Hi,
    Relationship which you are pointing out is like parent-child.
    You can maintain field A as masterdata bearing with Field B & C
    as navigational attributes of it. Even it infoprovider you make it as Navigational.
    Hope this thought will hepl you solve your prob.
    Bobby

  • LIS help needed : SD Extraction

    Hi Gurus
    I am fairly new to SD and am looking for some help regarding LIS
    I have setup a sales process which uses Inquiries > Quotation > Sales Order > Delivery Process. The Process is running fine.
    However when I am trying to get some basic reports using the Standard Analyses for customer / material I am getting the message "No Data Exists for Chosen Selection"
    Looking through the forums i tried to use the LIS Check utility from IMG and executed it for Infostructure S016 :SIS sales activities and it gives me an error in Check units "No DDIC information for source field MCEKPO"
    Please tell me what I need to do. I am using ECC 6.0 and there is no BIW system connected to SAP system. Therefore we have to generate reports using Standard ABAP queries.
    Any help is welcome. Will definitely award points to all helpful answers
    Thanks in advance

    Hi Ravi
    Thanks for responding.
    I am aware of these option and right now I am using the standard analyses (MCTA, MCTC etc.).
    My query is what do I have to do to set up reporting using the standard SAP Analyses. I am able to do my sales transactions but am not able to see them in the analysis.
    Problem was resolved... got the response on another channel.. thanks everyone..
    Regards
    Pranav
    Message was edited by:
            Pranav Kumar

  • Help needed in  extracting data from PCD tables

    Hi Friends
    I Have a requiremnt for creating custom portal activity report ,even though
    we have  standard report, the extraced data will be used to create bw reports later.
    my part is to find a way to extract the data from PCD tables for creating
    custom portal activity reports
    i have selected the following  tables for the data extraction
    WCR_USERSTAT,WCR_WEBCONTENTSTAT,WCR_USERFIRSTLOGON,
    WCR_USERPAGEUSAGE.
    My questions are
    1.Did i select the Exact PCD tables?
    2.Can i use UME api  for  accessing the data from those tables?
    3.can i use  the data extracted  from PCD tables in JSPdynpage  or
    webdynpro apps?
    4.can i Querry  the  PCD tables from  JSPDynpage or Webdynpro
    Please help me in finding a solution for this
    Thanks
    Ashok Battula

    Hi daniel
    Can u tell  me weather i can develop the following  custom reports from those WCR tables
         Report Type
    1     Logins
          - Unique Count
          - Total Count
          - Most Active Users (by Partner Name)
          - Most Active Users (by Contact Name)
          - Entry Point (by page name)
          - Session Time
          - Hourly Traffic Analysis
    2     Login Failures
          - Total Count
          - Count by error message
          - Credentials Entered (by user name and password)
    3     Content Views (by File Name)
          - Unique Count
          - Total Count
          - Most requested Files
          - Most requested Pages
          - File Not Found
    4     Downloads (by File Name)
          - Unique Count
          - Total Count
          - Most requested Files
          - File Not Found
    5     Portal Administration
          - Site Content (by file name)
          - Site Content (by page name)
          - Latest Content (by file name)
          - Expired Content (by file name)
          - Subscriptions Count (by file name)
    6     Login History (by Partner, Contact Name)
          - No Login
          - First Login
          - Duration between registration and first login
          - Most Recent Login
          - Average Number of Logins
    plz  help me in find ing a way
    thanks
    ashok

  • Help needed to extract a value from Textfield

    Hi,
    I am new to AWT prgramming .
    I have created a menu called " Menu System Test window " and it contains toplevel menu item "File" and File Menu contains subitems "Product Evaluation" and "Exit".
    When i click File->Product Evaluation it displays a new Frame named "ProductEvaluationMeasurementTool" with some check boxes ,radiobuttons, buttons , text fields.
    After compiling the program if i check some check boxes and radiobuttons and press Button1 it displays the result as no of checkboxes checked divided by total no of checkboxes(which i have declared as 18 in my code) in textField1.
    I also have textField2 for entering user input.
    now my question is after compiling program i check some checkboxes , enter some value in textField2 and press Button2. The result should be diplayed as no of checkboxes checked plus the value added in textField2 divided by total no of checkboxes(which is 18 in my code) . This result should be displayed in textField3.
    Can anyone help me?
    Thanks in advance
    i am sending my code.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Component;
    import java.awt.Checkbox;
    import javax.swing.*;
    // Make a main window with a top-level menu: File
    public class MainWindow extends Frame {
      public MainWindow() {
        super("Menu System Test Window");
        setSize(500, 500);
        // make a top level File menu
        FileMenu fileMenu = new FileMenu(this);
        // make a menu bar for this frame
        // and add top level menus File and Menu
        MenuBar mb = new MenuBar();
        mb.add(fileMenu);
        setMenuBar(mb);
        addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            exit();
      public void exit() {
        setVisible(false); // hide the Frame
        dispose(); // tell windowing system to free resources
        System.exit(0); // exit
      public static void main(String args[]) {
        MainWindow w = new MainWindow();
        w.setVisible(true);
    // Encapsulate the look and behavior of the File menu
    class FileMenu extends Menu implements ActionListener {
        private MainWindow mw; // who owns us?
      private MenuItem itmPE   = new MenuItem("ProductEvaluation");
      private MenuItem itmExit = new MenuItem("Exit");
      public FileMenu(MainWindow main)
        super("File");
        this.mw = main;
        this.itmPE.addActionListener(this);
        this.itmExit.addActionListener(this);
        this.add(this.itmPE);
        this.add(this.itmExit);
      // respond to the Exit menu choice
      public void actionPerformed(ActionEvent e)
        if (e.getSource() == this.itmPE)
         Frame f = new Frame("ProductMeasurementEvaluationTool");
         f.setSize(1290,1290);
         f.setLayout(null);
         TextField t1 = new TextField("textField1");
         t1.setBounds(230, 630, 50, 24);
         f.add(t1);
         TextField t2 = new TextField("textField2");
         t2.setBounds(430, 630, 50, 24);
         f.add(t2);
         TextField t3 = new TextField("textField3");
         t3.setBounds(630, 630, 50, 24);
         f.add(t3);
         Label l1 = new Label("Select the appropriate metrics for Measurement Process Evaluation");
         l1.setBounds(380, 50, 380, 20);
         f.add(l1);
         Label l2 = new Label("Architecture Metrics");
         l2.setBounds(170, 100, 110, 20);
         f.add(l2);
         Label l3 = new Label("RunTime Metrics");
         l3.setBounds(500, 100, 110, 20);
         f.add(l3);
         Label l4 = new Label("Documentation Metrics");
         l4.setBounds(840, 100, 130, 20);
         f.add(l4);
         JRadioButton rb1 = new JRadioButton("Componenent Metrics",false);
         rb1.setBounds(190, 140, 133, 20);
         f.add(rb1);
         JRadioButton rb2 = new JRadioButton("Task Metrics",false);
         rb2.setBounds(540, 140, 95, 20);
         f.add(rb2);
         JRadioButton rb3 = new JRadioButton("Manual Metrics",false);
         rb3.setBounds(870, 140, 108, 20);
         f.add(rb3);
         JRadioButton rb4 = new JRadioButton("Configuration Metrics",false);
         rb4.setBounds(190, 270, 142, 20);
         f.add(rb4);
         JRadioButton rb6 = new JRadioButton("DataHandling Metrics",false);
         rb6.setBounds(540, 270, 142, 20);
         f.add(rb6);
         JRadioButton rb8 = new JRadioButton("Development Metrics",false);
         rb8.setBounds(870, 270, 141, 20);
         f.add(rb8);
         Checkbox  c10 = new Checkbox("Size");
         c10.setBounds(220, 170, 49, 20);
         f.add(c10);
         Checkbox c11 = new Checkbox("Structure");
         c11.setBounds(220, 190, 75, 20);
         f.add(c11);
         Checkbox c12 = new Checkbox("Complexity");
         c12.setBounds(220, 210, 86, 20);
         f.add(c12);
         Checkbox c13 = new Checkbox("Size");
         c13.setBounds(220, 300, 49, 20);
         f.add(c13);
         Checkbox c14 = new Checkbox("Structure");
         c14.setBounds(220, 320, 75, 20);
         f.add(c14);
         Checkbox c15 = new Checkbox("Complexity");
         c15.setBounds(220, 340, 86, 20);
         f.add(c15);
         Checkbox c19 = new Checkbox("Size");
         c19.setBounds(580, 170, 49, 20);
         f.add(c19);
         Checkbox c20 = new Checkbox("Structure");
         c20.setBounds(580, 190, 75, 20);
         f.add(c20);
         Checkbox c21 = new Checkbox("Complexity");
         c21.setBounds(580, 210, 86, 20);
         f.add(c21);
         Checkbox c22 = new Checkbox("Size");
         c22.setBounds(580, 300, 49, 20);
         f.add(c22);
         Checkbox c23 = new Checkbox("Structure");
         c23.setBounds(580, 320, 75, 20);
         f.add(c23);
         Checkbox c24 = new Checkbox("Complexity");
         c24.setBounds(580, 340, 86, 20);
         f.add(c24);
         Checkbox c28 = new Checkbox("Size");
         c28.setBounds(920, 170, 49, 20);
         f.add(c28);
         Checkbox c29 = new Checkbox("Structure");
         c29.setBounds(920, 190, 75, 20);
         f.add(c29);
         Checkbox c30 = new Checkbox("Complexity");
         c30.setBounds(920, 210, 86, 20);
         f.add(c30);
         Checkbox c31 = new Checkbox("Size");
         c31.setBounds(920, 300, 49, 20);
         f.add(c31);
         Checkbox c32 = new Checkbox("Structure");
         c32.setBounds(920, 320, 75, 20);
         f.add(c32);
         Checkbox c33 = new Checkbox("Complexity");
         c33.setBounds(920, 340, 86, 20);
         f.add(c33);
         ActionListener action = new MyActionListener(f, t1, t2,t3);
         Button b1  = new Button("Button1");
         b1.setBounds(230, 600, 120, 24);
         b1.addActionListener(action);
         f.add(b1);
         Button b2  = new Button("Button2");
         b2.setBounds(430, 600, 120, 24);
         b2.addActionListener(action);
         f.add(b2);
               f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e)
              System.exit(0);
         f.show();
        else
       { mw.exit();}
    class MyActionListener implements ActionListener
      private Frame     frame;
      private TextField textField1;
      private TextField textField2;
      private TextField textField3;
      public MyActionListener(Frame frame, TextField tf1, TextField tf2,TextField tf3)
        this.frame = frame;
        this.textField1 = tf1;
        this.textField2 = tf2;
        this.textField3 = tf3;
      public void actionPerformed(ActionEvent e)
        String s = e.getActionCommand();
        if (s.equals("Button1"))
            Component[] components = this.frame.getComponents();
      int numOfCheckBoxes = 18;
      int numChecked = 0;
      for (int i = 0; i < components.length; i++)
            if (components[i] instanceof Checkbox)
              if (((Checkbox)components).getState())
    numChecked++;
    double ratio = (double) numChecked / (double) numOfCheckBoxes;
    this.textField1.setText(Double.toString(ratio));
    else
    if (s.equals("Button2"))
    Component[] components = this.frame.getComponents();
    int numOfCheckBoxes = 18;
    int numChecked = 0;
    for (int i = 0; i < components.length; i++)
    if (components[i] instanceof Checkbox)
    if (((Checkbox)components[i]).getState())
    numChecked++;
    double ratio = (double) numChecked / (double) numOfCheckBoxes;
    // I think some methods should be writen here to get the user input from textField2 before displaying ratio in textField3
    this.textField3.setText(Double.toString(ratio));

                // The result should be diplayed as
                // no of checkboxes checked                 ->           numChecked
                // plus the value added in textField2       ->           input
                double input = Double.parseDouble(textField3.getText());
                // divided by total no of checkboxes       ->            numOfCheckBoxes
                double ratio = (numChecked + input) / (double) numOfCheckBoxes;
                // This result should be displayed in textField3
                this.textField2.setText(Double.toString(ratio));

Maybe you are looking for

  • Yoga 2 Pro - Win 8.1 x64 Pro - VeriFace doesn't work for Domain accounts

    First - Lenovo's own tech support team seems completely unprepared for this product.  There are no install packages online for anything but core drivers and the support teams really don't know much about the custom Lenovo software like VeriFace.  Not

  • How to determine a BP from the user

    HI Experts, We have a scenario where there are contract employee's which are not maintained in the system as employee but maintained as BP, now during creation of any transaction i need to determine the contract BP based on the user, in the user mast

  • Keyboard input bug with non-english chars

    Hi community, i'm facing a weird problem with the following flex application (something very simple, couldn't be more): <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">      <mx:TextI

  • How to create a duplicate address book contact?

    This seems so simple yet I cannot determine how to create a new duplicate address book contact. I have a few contacts from the same company and want to change the variable data instead of re entering the data I can create a new contact, copy the data

  • Retain session in java client , which invokes a dotnet webservice

    Hello Forum, I am invoking a dotnet webservice using a java client. But I am not able to maintain session in this java client. I googled this, I got many links for the above. But none of the solution was using pure sun api's. My need is to do the sam