How to call URL to collect user input ?

Hi all,
I am writing a Swing applications and at some points, I need to call a URL (external web page) to collect user input. It invokes passing certain parameters to web page so that the web page can be displayed in some certain form. After the user input all data in web page, press "submit", my Swing application needs to get the input back. I suppose that calling URL is trivial but how can I get the input back ? Any input will be greatly appreicated.
Note: the web page will be displayed in one JFrame but it may not related to this problem.
C.K.

response.sendRediresc("http://.......);
public void sendRedirect(java.lang.String location)
                  throws java.io.IOException
    Sends a temporary redirect response to the client using the specified redirect location URL. This method can accept relative URLs; the servlet container must convert the relative URL to an absolute URL before sending the response to the client. If the location is relative without a leading '/' the container interprets it as relative to the current request URI. If the location is relative with a leading '/' the container interprets it as relative to the servlet container root.
    If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
    Parameters:
        location - the redirect location URL
    Throws:
        java.io.IOException - If an input or output exception occurs
        java.lang.IllegalStateException - If the response was committed or if a partial URL is given and cannot be converted into a valid URL

Similar Messages

  • How to check the value from user input in database or not?

    Hello;
    I want to check the value of user input from JtextFiled in my database or not.
    If it is in database, then i will pop up a window to tell us, otherwise, it will tell us it is not in database.
    My problem is my code do not work properly, sometimes, it tell me correct information, sometime it tell wrong information.
    Could anyone help,please.Thanks
    The following code is for check whether the value in database or not, and pop up a window to tell us.
    while( rs.next()) {
                    System.out.println("i am testing");
                    bInt=new Integer(rs.getInt("id"));
                    if(aInt.equals(bInt)){ // If i find the value in data base, set flag to 1.
                  flag=1;  //I set a flag to check whether the id in database or not
                        break;
             System.out.println("falg" + flag);
                if(flag==1){ //?????????????????????
              String remove1 = "DELETE FROM Rental WHERE CustomerID=" + a;
              String remove2 = "DELETE FROM Revenus WHERE CustomerID=" +a;
              String remove3 = "DELETE FROM Customer WHERE id=" +a;
              s.executeUpdate(remove1);
              s.executeUpdate(remove2);
              s.executeUpdate(remove3);
                    JOptionPane.showMessageDialog(null,"you have success delete the value");
              s.close();
             else//???????????????????????????????
                  JOptionPane.showMessageDialog(null,"I could not found the value"); -------------------------------------------------------------------
    My whole program
    import java.sql.*;
    import java.awt.BorderLayout;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JOptionPane;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    public class DeleteC extends JFrame
        public static int index=0;   
        public static ResultSet rs;
        public static Statement s;
        public static Connection c;
        public static  Object cols[][];
        private static JTable table;
        private static JScrollPane scroller;
        private static int flag=0;
        public DeleteC()
            //information of our connection
            //the url of the database: protocol:subprotocol:subname:computer_name:port:database_name
            String strUrl      = "jdbc:oracle:thin:@augur.scms.waikato.ac.nz:1521:teaching";
            //user name and password
            String strUser      = "xbl1";
            String strPass      = "19681978";
            //try to load the driver
            try {
                Class.forName("oracle.jdbc.driver.OracleDriver");
            catch (ClassNotFoundException e) {
                System.out.println( "Cannot load the Oracle driver. Include it in your classpath.");
                System.exit( -1);
            //a null reference to a Connection object
            c = null;
            try {
                //open a connection to the database
                c = DriverManager.getConnection( strUrl, strUser, strPass);
            catch (SQLException e) {
                System.out.println("Cannot connect to the database. Here is the error:");
                e.printStackTrace();
                System.exit( -1);
           //create a statement object to execute sql statements
        public void getData(String a){
            try {
             //create a statement object to execute sql statements
             s = c.createStatement();
                int index=0;
                Integer aInt= Integer.valueOf(a);
                Integer bInt;
                  //our example query
                String strQuery = "select id from customer";
                //execute the query
                ResultSet rs = s.executeQuery( strQuery);
                //while there are rows in the result set
                while( rs.next()) {
                    System.out.println("i am testing");
                    bInt=new Integer(rs.getInt("id"));
                    if(aInt.equals(bInt)){
                  //JOptionPane.showMessageDialog(null,"I found the value"); 
                  flag=1;
                        break;
             System.out.println("falg" + flag);
                if(flag==1){
              String remove1 = "DELETE FROM Rental WHERE CustomerID=" + a;
              String remove2 = "DELETE FROM Revenus WHERE CustomerID=" +a;
              String remove3 = "DELETE FROM Customer WHERE id=" +a;
              s.executeUpdate(remove1);
              s.executeUpdate(remove2);
              s.executeUpdate(remove3);
                    JOptionPane.showMessageDialog(null,"you have success delete the value");
              s.close();
             else
                  JOptionPane.showMessageDialog(null,"I could not found the value");
            catch (SQLException e) {
                 JOptionPane.showMessageDialog(null,"You may enter wrong id");
    My main program for user input from JTextField.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.util.*;
    public class EnterID extends JFrame{
        public JTextField tF1;
        public EnterID enID;
        public String tF1Value;
        private JLabel label1, label2, label3;
        private static JButton button;
        private static ButtonHandler handler;
        private static String aString;
        private static Integer aInteger;
        private static Integer checkV=0;
        public static void main(String args[]){
           EnterID eId= new EnterID();
       public EnterID(){
          handler=new ButtonHandler();
          Container c= getContentPane();
          c.setLayout(new GridLayout(3,1));
          button= new JButton("ok");
          button.addActionListener(handler);
          label1 = new JLabel(" CustomerID, Please");
          label2 = new JLabel("Label2");
          label3 = new JLabel();
          label3.setLayout(new GridLayout(1,1));
          label3.add(button);
          label2.setLayout(new GridLayout(1,1));
          aString = "Enter Id Here";
          tF1 = new JTextField(aString);
          label2.add(tF1);
          c.add(label1);
          c.add(label2);         
          c.add(label3);            
          setSize(150,100);
          setVisible(true);     
       private class ButtonHandler implements ActionListener{
         public void actionPerformed(ActionEvent event){
             tF1Value=tF1.getText();
            //   CheckData cData = new CheckData();
             //  aInteger = Integer.valueOf(tF1Value);      
             if(tF1Value.equals(aString)){
              JOptionPane.showMessageDialog(null,"You didn't type value into box");
              setVisible(false); 
            else {
                DeleteC dC= new DeleteC();
                dC.getData(tF1Value);
                setVisible(false); 
    }

    You may have working code now, but the code you posted is horrible and I'm going to tell you a much much much better approach for the JDBC part. (You should probably isolate your database code from your user interface code as well, but I'm skipping over that structural problem...)
    Do this instead:
        public void getData(String a){
            PreparedStatement p;
            String strQuery = "select count(*) the_count from customer where id = ?";
            try {   
             //create a prepared statement object to execute sql statements, it's better, faster, safer
             p = c.prepareStatement(strQuery);
                // bind the parameter value to the "?"
                p.setInt(1, Integer.parseInt(a) );
                //execute the query
                ResultSet rs = p.executeQuery( );
                // if the query doesn't throw an exception, it will have exactly one row
                rs.next();
                System.out.println("i am testing");
                if (rs.getInt("the_count") > 0 ) {
                // it's there, do what you need to...
             else
                  JOptionPane.showMessageDialog(null,"I could not find the value");
            catch (SQLException e) {
                 // JOptionPane.showMessageDialog(null,"You may enter wrong id");
                 // if you get an exception, something is really wrong, and it's NOT user error
            // always, always, ALWAYS close JDBC resources in a finally block
            finally
                p.close();
        }First, this is simpler and easier to read.
    Second, this retrieves just the needed information, whether or not the id is in the database. Your way will get much much slower as more data goes into the database. My way, if there is an index on the id column, more data doesn;t slow it down very much.
    I've also left some important points in comments.
    No guarantees that there isn't a dumb typo in there; I didn't actually compile it, much less test it. It's at least close though...

  • How to call url from abap in background

    Hi,
    I could open url but it opens browser window
    i saw several threads on how to cal url in background but no good answer
    kindly help
    thanks
    B

    Hi,
    Try the following (primitive) example, it calls an url and display the result on screen.
    Hope this will help you.
    <pre>
    REPORT  test.
          CLASS lcx_http_client DEFINITION
          Minimal Error Handling
    CLASS lcx_http_client DEFINITION INHERITING FROM cx_static_check.
      PUBLIC SECTION.
        INTERFACES:
          if_t100_message.
        DATA:
           mv_method TYPE string,                               "#EC NEEDED
           mv_subrc  TYPE i.                                    "#EC NEEDED
        METHODS:
          constructor
            IMPORTING iv_method TYPE string  OPTIONAL
                      iv_subrc  TYPE i       OPTIONAL
                      iv_msgid  TYPE symsgid DEFAULT '00'
                      iv_msgno  TYPE i       DEFAULT 162.
    ENDCLASS.                    "lcx_http_client DEFINITION
          CLASS lcx_http_client IMPLEMENTATION
    CLASS lcx_http_client IMPLEMENTATION.
      METHOD constructor.
        super->constructor( ).
        mv_method = iv_method.
        mv_subrc  = iv_subrc.
        if_t100_message~t100key-msgid = iv_msgid.
        if_t100_message~t100key-msgno = iv_msgno.
        if_t100_message~t100key-attr1 = 'MV_METHOD'.
        if_t100_message~t100key-attr2 = 'MV_SUBRC'.
      ENDMETHOD.                    "constructor
    ENDCLASS.                    "lcx_http_client IMPLEMENTATION
          CLASS lcl_http_client DEFINITION
          Facade for if_http_client
    CLASS lcl_http_client DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          get_http_client_by_url
            IMPORTING iv_url           TYPE string
                      iv_proxy_host    TYPE string OPTIONAL
                      iv_proxy_service TYPE string OPTIONAL
                      PREFERRED PARAMETER iv_url
            RETURNING value(ro_http_client) TYPE REF TO lcl_http_client
            RAISING lcx_http_client.
        DATA:
          mr_http_client TYPE REF TO if_http_client.
        METHODS:
          send
            RAISING lcx_http_client,
          receive
            RAISING lcx_http_client,
          close
            RAISING lcx_http_client,
          get_response_header_fields
            RETURNING value(rt_fields) TYPE tihttpnvp,
          get_response_cdata
            RETURNING value(rv_data) TYPE string.
    ENDCLASS.                    "lcl_http_client DEFINITION
          CLASS lcl_http_client IMPLEMENTATION
    CLASS lcl_http_client IMPLEMENTATION.
      METHOD get_http_client_by_url.
        DATA: lv_subrc TYPE sysubrc.
        CREATE OBJECT ro_http_client.
        cl_http_client=>create_by_url( EXPORTING url                 = iv_url
                                                 proxy_host          = iv_proxy_host
                                                 proxy_service       = iv_proxy_service
                                       IMPORTING client              = ro_http_client->mr_http_client
                                       EXCEPTIONS argument_not_found = 1
                                                  plugin_not_active  = 2
                                                  internal_error     = 3
                                                  OTHERS             = 999 ).
        CHECK sy-subrc <> 0.
        lv_subrc = sy-subrc.
        RAISE EXCEPTION TYPE lcx_http_client EXPORTING iv_method = 'GET_HTTP_CLIENT_BY_URL' iv_subrc = lv_subrc.
      ENDMETHOD.                    "get_http_client_by_url
      METHOD send.
        DATA: lv_subrc TYPE sysubrc.
        mr_http_client->send( EXCEPTIONS http_communication_failure = 5
                                         http_invalid_state         = 6
                                         http_processing_failed     = 7
                                         http_invalid_timeout       = 8
                                         OTHERS                     = 999 ).
        CHECK sy-subrc <> 0.
        lv_subrc = sy-subrc.
        RAISE EXCEPTION TYPE lcx_http_client EXPORTING iv_method = 'SEND' iv_subrc = lv_subrc.
      ENDMETHOD.                    "send
      METHOD close.
        DATA: lv_subrc TYPE sysubrc.
        CALL METHOD mr_http_client->close
          EXCEPTIONS
            http_invalid_state = 10
            OTHERS             = 999.
        CHECK sy-subrc <> 0.
        lv_subrc = sy-subrc.
        RAISE EXCEPTION TYPE lcx_http_client EXPORTING iv_method = 'CLOSE' iv_subrc = lv_subrc.
      ENDMETHOD.                    "close
      METHOD receive.
        DATA: lv_subrc TYPE sysubrc.
        mr_http_client->receive( EXCEPTIONS http_communication_failure = 9
                                            http_invalid_state         = 10
                                            http_processing_failed     = 11
                                            OTHERS                     = 999 ).
        CHECK sy-subrc <> 0.
        lv_subrc = sy-subrc.
        RAISE EXCEPTION TYPE lcx_http_client EXPORTING iv_method = 'RECEIVE' iv_subrc = lv_subrc.
      ENDMETHOD.                    "receive
      METHOD get_response_header_fields.
        mr_http_client->response->get_header_fields( CHANGING fields = rt_fields ).
      ENDMETHOD.                    "get_response_header_fields
      METHOD get_response_cdata.
        rv_data = mr_http_client->response->get_cdata( ).
      ENDMETHOD.                    "get_response_cdata
    ENDCLASS.                    "lcl_http_client IMPLEMENTATION
    PARAMETERS: p_url   TYPE string DEFAULT 'http://www.google.com' LOWER CASE,
                p_phost TYPE string DEFAULT 'your_proxy_here'       LOWER CASE,
                p_pserv TYPE string DEFAULT '8080'                  LOWER CASE.
    *===================================================================================
    START-OF-SELECTION.
      TRY .
          DATA: gt_data          TYPE string_table,
                gv_data          TYPE string,
                gr_http_client   TYPE REF TO lcl_http_client,
                go_cx            TYPE REF TO lcx_http_client.
          "Initialize the http client
          gr_http_client =
            lcl_http_client=>get_http_client_by_url( iv_url           = p_url
                                                     iv_proxy_host    = p_phost
                                                     iv_proxy_service = p_pserv ).
          "Call the specified URL and retrieve data from the response
          gr_http_client->send( ).
          gr_http_client->receive( ).
          gv_data = gr_http_client->get_response_cdata( ).
          "Its over....
          gr_http_client->close( ).
          "Display result
          REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf IN gv_data WITH cl_abap_char_utilities=>newline.
          SPLIT gv_data AT cl_abap_char_utilities=>newline INTO TABLE gt_data.
          LOOP AT gt_data INTO gv_data.
            WRITE: / gv_data.
          ENDLOOP.
        CATCH lcx_http_client INTO go_cx.
          MESSAGE go_cx TYPE 'S' DISPLAY LIKE 'E'.
      ENDTRY.
    </pre>

  • How to change date format of user input prompt in infoview.

    Hi All,
    Every report webi or deski having date field as prompt when viewed in view mode in infoview shows date format as M/d/yyyy h:mm:ss a.
    Where this format is stored and how can we change it to dd/mm/yyyy.
    Any ideas.
    Regards,
    Gaurav

    Not sure id this helps...
    I was up against a similar issue of placing the user input dates, Starting & Ending, into one cell for a reference on each report header. After a few hours of diligence, I came up with a working model that finally worked:
    u_StartDateAsTXT=FormatDate(ToDate(UserResponse("Enter Date/Time Shipped (Start):");"MM/dd/yyyy hh:mm:ss a");"MM/dd/yyyy")
    and
    u_EndDateAsTXT=FormatDate(ToDate(UserResponse("Enter Date/Time Shipped (END):");"MM/dd/yyyy hh:mm:ss a");"MM/dd/yyyy")
    The report header has the following function:
    =u_StartDateAsTXT + u201C u2013 u201C + u_EndDateAsTXT

  • How to display records that match user input date

    hi all,
      i need to display records that match user input date (i.e., for example if the difference between user input date and record date is less than 5 years then display those records) , this is for hr bw. any exit is there to check for validation for records to be displayed based on some abap coding.
    vijay

    I just see getApplication method but "Retrieves a list of all the deployed applications."
    My scenario is: I get user, end i want to discorver how application this user i enable to see.

  • How to call  URL from BADDI??

    Hi,
    I have a requirement to call URL from BADI, i tried to use 'CALL BROWSER' function module,
    it works when we are working in GUI, but for portal/PCUI it gives sy-subrc = 2 ( Front end Error)
    How to call a pop up page or URL from poral??
    Thanks,
    Manoj
    Edited by: Manoj Lakhanpal on Sep 27, 2010 10:27 AM

    Hi!
    I'm using this code for calling a browser, you might try out as well...
    MOVE 'http://www.sap.com' TO command.
        CONCATENATE 'url.dll,FileProtocolHandler'
                    command
               INTO command
           SEPARATED BY space.
        MOVE 'rundll32' TO lv_application.
        CALL METHOD cl_gui_frontend_services=>execute
           EXPORTING
             APPLICATION            = lv_application
             PARAMETER              = command
           EXCEPTIONS
             CNTL_ERROR             = 1
             ERROR_NO_GUI           = 2
             BAD_PARAMETER          = 3
             FILE_NOT_FOUND         = 4
             PATH_NOT_FOUND         = 5
             FILE_EXTENSION_UNKNOWN = 6
             ERROR_EXECUTE_FAILED   = 7
             others                 = 8
    Regards
    Tamá

  • How to Format DataGridView Cells after user input, also find average of Timespans

    I'm a rather new to programming and slowly learning as best I can, and feel that I'm probably just getting hung up on some things because of my lack of overall understanding.  I've searched plenty online and these forums to figure out my issues, but
    somethings just go over my head or I can't figure out how to make it work for what I'm trying to do.
    On to what I'm trying to do.
    I'm working on building an app for scoring swim meets for our conference.  I'm using a lcal SQL DB for all of the data and have a DGV on my form.  We don't have timing systems so we take 2 times from stop watches and then need to do an average
    of the times to determine a swimmers time.  I have 3 fields for times, Time1, Time2 and AvgTime.
    What I'm needing help with is how do I allow the user to not worry about formatting the time they enter but have it automatically format what they input after they exit the cell on Time1 and Time2.  Then I need to have it figure out the average of those
    two times in AvgTime cell.  I'm able to get the averaging to work if I have the datatype set to decimal or int, but I can't get it to work if I have them set has TimeSpan.
    Below is the code I have currently.  As you can see I've got things commented out that I found online but couldn't make work.
    Thanks for taking the time to review this and help me out.
    Public Class EventScoring
    Private Sub EventScoring_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'MeetDataSet.DualLineup' table. You can move, or remove it, as needed.
    Me.DualLineupTableAdapter.Fill(Me.MeetDataSet.DualLineup)
    'TODO: This line of code loads data into the 'MeetDataSet.EventList' table. You can move, or remove it, as needed.
    Me.EventListTableAdapter.Fill(Me.MeetDataSet.EventList)
    'DualLineupDataGridView.Columns(5).DefaultCellStyle.Format = ("mm\:ss\.ff")
    MeetDataSet.DualLineup.Columns("AvgTime").Expression = "(([Time1] + [Time2]) /2)"
    End Sub
    Private Sub Sub_Btn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Sub_Btn.Click
    Try
    Me.Validate()
    Me.DualLineupBindingSource.EndEdit()
    Me.DualLineupTableAdapter.Update(Me.MeetDataSet.DualLineup)
    MsgBox("Update successful")
    Catch ex As Exception
    MsgBox("Update failed")
    End Try
    End Sub
    'Private Sub DualLineupDataGridView_CellFormatting(ByVal sender As Object, ByVal e As DataGridViewCellFormattingEventArgs) Handles DualLineupDataGridView.CellFormatting
    ' If ((e.ColumnIndex = 5) AndAlso (Not IsDBNull(e.Value))) Then
    ' Dim tp As TimeSpan = CType(e.Value, TimeSpan)
    ' Dim dt As DateTime = New DateTime(tp.Ticks)
    ' e.Value = dt.ToString("mm\:ss\.ff")
    ' End If
    'End Sub
    'Private Sub DualLineupDataGridView_CurrentCellDirtyStateChanged(ByVal sender As Object, ByVal e As DataGridViewCellFormattingEventArgs) Handles DualLineupDataGridView.CurrentCellDirtyStateChanged
    ' If ((e.ColumnIndex = 5) AndAlso (Not IsDBNull(e.Value))) Then
    ' Dim tp As TimeSpan = CType(e.Value, TimeSpan)
    ' Dim dt As DateTime = New DateTime(tp.Ticks)
    ' e.Value = dt.ToString("mm\:ss\.ff")
    ' End If
    'End Sub
    End Class

    AB,
    If you're ok with your database other than working out this issue with time, you might want to give the following a try. It's pretty flexible in that you can give it a string or a decimal, and I'll explain:
    The string can be in the format of "mm:ss" (minutes and seconds) or in the format of "mm:ss:f~".
    The reason that I put the tilda there is because you're not limited on the number of decimal places - it will work out the math to figure out what you meant.
    Also though, you can give it a decimal value representing the total number of seconds. Do be sure to clearly denote that it's a decimal type (otherwise it will assume it's a double and will fail). Here's the class:
    Public Class SwimmerTime
    Private _totalSeconds As Decimal
    Public Sub New(ByVal value As Object)
    Try
    Dim tSeconds As Decimal = 0
    If TypeOf value Is String Then
    Dim s As String = CType(value, String)
    If Not s.Contains(":"c) Then
    Throw New ArgumentException("The string is malformed and cannot be used.")
    Else
    Dim elements() As String = s.Split(":"c)
    For Each element As String In elements
    If Not Integer.TryParse(element, New Integer) Then
    Throw New ArgumentException("The string is malformed and cannot be used.")
    End If
    Next
    If elements.Length = 2 Then
    tSeconds = (60 * CInt(elements(0)) + CInt(elements(1)))
    ElseIf elements.Length = 3 Then
    tSeconds = (60 * CInt(elements(0)) + CInt(elements(1)))
    Dim divideByString As String = "1"
    For Each c As Char In elements(2)
    divideByString &= "0"
    Next
    tSeconds += CDec(elements(2)) / CInt(divideByString)
    Else
    Throw New ArgumentException("The string is malformed and cannot be used.")
    End If
    End If
    ElseIf TypeOf value Is Decimal Then
    Dim d As Decimal = DirectCast(value, Decimal)
    tSeconds = d
    Else
    Throw New ArgumentException("The type was not recognizable and cannot be used.")
    End If
    If tSeconds = 0 Then
    Throw New ArgumentOutOfRangeException("Total Seconds", "Must be greater than zero.")
    Else
    _totalSeconds = tSeconds
    End If
    Catch ex As Exception
    Throw
    End Try
    End Sub
    Public Shared Function GetAverage(ByVal value1 As Object, _
    ByVal value2 As Object) As SwimmerTime
    Dim retVal As SwimmerTime = Nothing
    Try
    Dim st1 As SwimmerTime = New SwimmerTime(value1)
    Dim st2 As SwimmerTime = New SwimmerTime(value2)
    If st1 IsNot Nothing AndAlso st2 IsNot Nothing Then
    Dim tempList As New List(Of Decimal)
    With tempList
    .Add(st1.TotalSeconds)
    .Add(st2.TotalSeconds)
    End With
    Dim averageSeconds As Decimal = tempList.Average
    retVal = New SwimmerTime(averageSeconds)
    End If
    Catch ex As Exception
    Throw
    End Try
    Return retVal
    End Function
    Public ReadOnly Property FormattedString As String
    Get
    Dim ts As TimeSpan = TimeSpan.FromSeconds(_totalSeconds)
    Return String.Format("{0:00}:{1:00}:{2:000}", _
    ts.Minutes, _
    ts.Seconds, _
    ts.Milliseconds)
    End Get
    End Property
    Public ReadOnly Property TotalSeconds As Decimal
    Get
    Return _totalSeconds
    End Get
    End Property
    End Class
    I'll show how to use it by example:
    Option Strict On
    Option Explicit On
    Option Infer Off
    Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load
    Try
    Dim averageSwimmerTime As SwimmerTime = _
    SwimmerTime.GetAverage("02:24:05", 145.3274D)
    MessageBox.Show(String.Format("Formatted String: {0}{1}Actual Value: {2}", _
    averageSwimmerTime.FormattedString, vbCrLf, _
    averageSwimmerTime.TotalSeconds), _
    "Average Swimmer Time")
    Stop
    Catch ex As Exception
    MessageBox.Show(String.Format("An error occurred:{0}{0}{1}", _
    vbCrLf, ex.Message), "Program Error", _
    MessageBoxButtons.OK, MessageBoxIcon.Warning)
    End Try
    Stop
    End Sub
    End Class
    An advantage here is that since it returns an instance of the class, you have access to the formatted string, and the actual decimal value.
    I hope you find this helpful. :)
    Still lost in code, just at a little higher level.

  • How to call proc in package having input as accociative array

    Hi,
    I want to call a proc inside a package having input paramter as accociative array.How can it be called.?
    The signature of package is as follows
    TYPE ar_line_details_rec IS RECORD (
    mfg_part_num VARCHAR2 (100),
    description VARCHAR2 (1000),
    line_amount NUMBER (14, 2)
    TYPE ar_line_dtls_tab IS TABLE OF ar_line_details_rec
    INDEX BY BINARY_INTEGER;
    PROCEDURE dca_saf_feedback_pr (
    p_dca_id IN dca_header.dca_id%TYPE,
    p_memo_number IN dca_header.memo_number%TYPE,
    p_memo_amt IN dca_header.memo_amt%TYPE,
    p_memo_created_date IN dca_header.memo_created_date%TYPE,
    p_ar_line_dtls IN ar_line_dtls_tab,
    p_code IN NUMBER,
    p_mesg IN VARCHAR2,
    p_rtncode OUT NUMBER,
    p_rtnmessage OUT VARCHAR2
    I want to calls the proc dca_saf_feedback_pr .So can it be done?
    Thanks,
    Tanmoy

    Yes, %TYPE is not required here.
    -- If your package name is DCA_SAF_FEEDBACK_PKG & you want to pass associative array as assoc
    DECLARE
    -- declare associative array
      assoc dca_saf_feedback_pkg.ar_line_dtls_tab;
      retcode VARCHAR2(200);
      remsg   VARCHAR2(200);
    BEGIN
    -- initialize associative array
      assoc(1).mfg_part_num:=10;
      assoc(1).description :='assoc';
      assoc(1).line_amount :=1000;
    --pass associative array
      dca_saf_feedback_pkg.dca_saf_feedback_pr (
              p_dca_id =>1,
              p_memo_number => 2,
              p_memo_amt => 200,
              p_memo_created_date=> SYSDATE,
              p_ar_line_dtls =>assoc,
              p_code=> 100,
              p_mesg =>'assoc',
              p_rtncode => retcode,
              p_rtnmessage =>rmsg);
    END;Regards,
    Ankit Rathi
    http://theoraclelog.blogspot.in

  • How to calculate the total from users input in switch?

    I dont know how to hold the input from user. But here is part of my coding :
    System.out.println ("Type 1 for buying Ruler"+
    "\nType 2 for buying Pencil");
    stationaries = console.nextInt();
    switch (stationaries)
    case 1 : System.out.println("Ruler per unit : MYR1");
    System.out.println("How much does you want? : ")
    wantRuler = console.nextInt();
    sum = wantRuler * 1;
    break;
    case 2 : System.out.println("Pencil per unit : MYR2");
    System.out.println("How much does you want? : ")
    wantPencil = console.nextInt();
    sum = wantPencil * 2;
    break;
    How can I calculate the total for both of the stationaries if user wants 5 for ruler and 6 for pencil?

    Note: This thread was originally posted in the [Java Programming|http://forums.sun.com/forum.jspa?forumID=31] forum, but moved to this forum for closer topic alignment.
    Use code tags to post codes -- [code]CODE[/code] will display asCODEOr click the CODE button and paste your code between the {code} tags that appear.

  • How to call custom screen from User exit?

    Hai,
    I have to call a custom screen from user exit include after the delivery save.
    Depends on the data in the delivery,
    if the data satisfies certain conditions I will call the screen otherwise no.
    Could any one please tell me how to do this?where to create screen & how to link it here?
    Regards,
    Bhaskar.

    Hi,
    Please check with the following Enhancements -
    V50PSTAT  - Delivery: Item Status Calculation 
    V50Q0001   - Delivery Monitor: User Exits for Filling Display Fields
    Rewards if it helps
    Regard
    Goutham

  • In chart (graph), How to set scale value dynamically(user input scale val.)

    Hi ,
    I am using Crystal Reports XI R2.
    I have specified scale value but user is asking he can decide scale value while running the chart like Y-axis major interval (inclement by) 10, 7, 4, .5, .25 etc.
    How to achieve this please give me suggestions.
    Thanks and regards,
    Manjunath N. Jogin

    I do not think this can be done dynamically,   You could build several sections, each with it's own graph,
    set the scales in each graph, in its section, and then supress sections based on parameter.
    So, you could have one section that is  5,10,15,20  etc.
    and another that is 8, 12, 16, 20  
    depending on what they want.

  • How to call URL in background or close the browser from ABAP

    Requirement changed.. no longer an issue. Thanks.
    Message was edited by:
            Atul Devasthali

    Hi He,
    This question has been asked (and answered) many times in this forum.
    Please do a search for words like "InitialContext", "RMIInitialContextFactory",
    and "weblogic". You will find lots of information.
    Also, the following web page has links to documentation, "how-tos"
    and sample code:
    http://otn.oracle.com/tech/java/oc4j/content.html
    Have you looked at it?
    Good Luck,
    Avi.

  • How to hide report errors when user input incorrect?

    I have a tabular report with output that's limited on date interval basis in the WHERE clause. So I have two date items that's used to set start and end dates accordingly. Both items have validations "Item specified is a valid date". How to hide error in report area when validation fires?
    screenshot http://ehype.com.ru/tmp/rep_error.jpg

    Have you tried putting a condition on the report region of type "No Inline Validation Errors Displayed"?
    Scott

  • How to force sql developer to prompt for user input for every execution ?

    Hi Folks,
    Environment: Oracle 11g (on Windows 7)
    SQL Developer: *3.1.07*
    I am executing a PL/SQL code off Sql Developer. The code uses substitution variables to prompt user for input. However,I am only prompted for the user input for the very first run of the code. For the subsequent executions, the code simply picks up the user input from the very first run. This behavior persists for all subsequent runs of the code.
    I have executed the same piece of code from SQL*PLUS and the behavior seems normal (i.e. I am prompted for fresh input for every execution)
    How can flush out the old user input so I can be prompted for new user input for every run of the code in sql developer?
    Thanks in advance
    rogers42

    Hi Rogers42,
    1/try
    undefine
    undefine fred
    select '&&fred' from dual;
    [run this multiple times]
    [prompts gere]
    old:select '&&fred' from dual
    new:select 'a' from dual
    'A'
    a
    [prompts here]
    old:select '&&fred' from dual
    new:select 'b' from dual
    'B'
    b
    2/try
    exit (requires recent version of sql developer: tools->preferences->Database->worksheet->Re-initialize on script exit command)
    select '&&fred' from dual;
    exit
    run this multiple times
    [prompts here]
    old:select '&&fred' from dual
    new:select 'x' from dual
    'X'
    x
    Commit
    [prompts here]
    old:select '&&fred' from dual
    new:select 'y' from dual
    'Y'
    y
    Commit
    3/use &fred instead of &&fred
    For background see
    http://totierne.blogspot.co.uk/2010/04/substitution-and-bind-variables.html
    -Turloch
    SQLDeveloper team

  • User input

    i am completely new to this, and am trying to write a simple program, but i am currently having the most difficulty in finding out how to collect user input...
    For example
    Please enter name? and nameVar would be used to collect the name typed.
    thanx much
    e

              try
                   System.out.println("Input a string: ");
                   InputStreamReader con = new InputStreamReader(System.in);
                   BufferedReader in = new BufferedReader(con);
                   message = in.readLine();
                   System.out.println("Value = "+message);
                   return message;
              catch(IOException e)
                   System.out.println("Exception "+e);
                   message = "error: "+e;
                   return message;
              }

Maybe you are looking for

  • Can't select object by fill

    So, I have ensured that Object Selection by Path Only is unchecked in the selection and anchor display prefs. However, I still can't select an object by fill (clicking within the object).  I have to go to the object edge and select the path. Any idea

  • Problem with F4 option for one field

    Hi, While creating pricing condition records (VK11), one field is not having F4 option. That field is KGKG1 (Condition group1). Ihave created one table with s.org, dist.channel and condition group1 (KDKG1). While creating onle this problem. While cha

  • Error Code: U43MID207

    Hi, Could anyone please help me with the following issues: Adobe Pixel Bender Toolkit 2.5 Update. Error downloading this update Error Code: U43MID207. Adobe Extension Manager CS5 5.0 Update. Error downloading this update Error Code: U43MID207. Adobe

  • Automator not starting

    I am having an issue with Automator in 10.5. It refuses to start at all. Begins the process, the beach ball spins and then it is gone and generates a "Send error report to Apple" message. Any one else? Any solutions? Thanks

  • How to export my iPad playlists?

    So I bought a brand new MacBook Pro. I transferred the apps I bought on my iPad to my new machine and I now sync my apps, contacts, bookmarks and calendar. No sweat. However, I have a ton of music on my iPad (not bought in the iTunes Store) neatly or