Retriving data from database on selecting particular value in the combo box

Hi,
On selecting the particular value from the combo box, the corresponding value of the other segement fields should be retrived from databse and displayed in the text box

Babel,
If you don't have a query bdoc and the business query that joins both 2 tables already, then please crate one.
After that, write this code on the change of the combobox.
You would have to change the names below for the Query, properties, anchor, parameters, controls.
===================================
Private Sub ctrlBankNameCombo_onValueChanged2(ByRef boundAttributeChanged As Boolean)
On Error Resume Next
Dim objBankQuery As BusinessQuery
Dim ObjBankCol As BusinessCollection
Dim strID As String
If Not boundAttributeChanged Then Exit Sub
strID = ""
strID = myanchor.bo.getAttribute("BankNameComboProperty") ' Bank ID
If strID <> "" Then
    Set objBankQuery = gServices.factory.newBusinessQuery("MyNewQuery")
    objBankQuery.Mandt = "000"
    objBankQuery.BANKID = strID
    Set ObjBankCol = objBankQuery.query 
       If Not ObjBankCol Is Nothing Then  
           ctrlBankAddress.Value = ObjBankCol.getAttribute(1, "BankAddress")
           ctrlBankPhone.Value = ObjBankCol.getAttribute(1, "BankPhone")
       End If
End If
===================================
Regards,
Vadim.

Similar Messages

  • How to retrive data  from  database views or projection views

    how to retrive data  from  database views or projection views

    Hi chintam,
    1. Very simple
    2. Just like normal select statement.
    3. Select * from VIEWNAME.
    4. (Instead of the tablename, we just have to give the viewname)
    regards,
    amit m.

  • How to get values in the combo box in a XML form?

    Hi All,
        1. I have created a property which has "Default value" as "Clothings" and  "Allowed Values(csv)" as Real Estate - Sales , Clothings etc" by navigating to KM > CM > Global Services > Property Metadata > Properties.
       2. In the XML form builder when I drag this property I get a combo box for this property.
       3. But when I preview this by going to Content Management > Folder > New > FORMS > and select my XML form project I get a preview but it is not showing me the default values in the combo boxes which I created using the property in XML form builder.
    Please Suggest me as to how to get those values (which I mentioned in property) in the combo box ?
    Thanks in Advance,
    Jasmine.

    Hi All,
      I ll make the above Query Simple.
    1.In Xml Form Builder when you drag a property which has some 3-4 assigned values so you are  recomended to use a combo box.
    2.But the problem after using COMBOBOX is I am not getting these values in the preview of the combo box.
    3.Help Required please its urgent.
    Thanks in advance,
    Jasmine.

  • Retriving data from database using JDBC and mysql.

    st=con.createStatement();
    st.executeUpdate("INSERT INTO temperature(`temp`) VALUES ('"+name+"')"); ResultSet rs = st.executeQuery("Select * from temperature");
    String s1="";
    while(rs.next())
    s1= rs.getString(1);
    document.write(s1+"-----------------------------");
    }when i am retriving data from data base i am getting data which i inserted before.how to display present inserted data? i heard we should use scrollable.can any one how to do this.
    Date&time: Thu Feb 28 18:41:40 PST 2008 -----------------------------NANDA----------------------------
    [[email protected]----1name=2name=3name=4name=5name=6-----------------------------
    1123456-----------------------------123456-----------------------------1,2,3,4,5,20-----------------------------

    Hi,
    st=con.createStatement();
    st.executeUpdate("INSERT INTO temperature(`temp`) VALUES ('"+name+"')");
    //Changes in the query
    ResultSet rs = st.executeQuery("Select * from temperature where temp ='"+name+"' ");
    String s1="";
    while(rs.next())
    s1= rs.getString(1);
    document.write(s1+"-----------------------------");
    //Select * from temperature where temp ='"+name+"'
    The above query which results the last updated information

  • Failed to retrive data from database Error

    Hi,
    I am working on Crystal report XI R2.0. Back end is Oracle and I am migrating the oracle database to MySQL database. After migrating the DB from oracle to MySQL, saved and closed the report. If I open the same reprt I am getting the following error.
    "Failed to retrive the data from database.Details:3D000.[MySQL][ODBC 5.1 Driver][mysqld-5.1.24-rc-community][No database selected]"
    Please let me know how to resolve this issue.
    Thanks,
    Udaya

    Hi Kalva,
                  Please can you let us know the version of MySql to which you have migrated the database? Are you able to create a new report with the help of the migrated database?
    You can try changing the connection type to ODBC, OLEDB etc.Also,you can use the 'Set Datasource Location' in the 'Database Expert' to make the report point to the correct database.
    Thanks,
    Alok.

  • Retriving data from database

    i want to match the value in request.getParameter("sort") to retrive my databse infromation. i did it like dat :
    rs = st.executeQuery("select * from cust_info where Acc_Name LIKE ''"+request.getParameter("sort")+"'%'");
    but tis doesnt seem to work. can anyone tell me the proper syntax?

    An alternative approach may help - use a PreparedStatement and then set the values using the PreparedStatement.set<type>(...) method.
    e.g.
    String sqlQuery = "select * from cust_info where Acc_Name LIKE ?";
    psQuery = conn.prepareStatement(sqlQuery);
    psQuery.setString(1, request.getParameter("sort") + "%");
    rs = psQuery.executeQuery();
    rs.next();
    // Process resultset here.The ?'s indicate a parameter that you are setting, all of the formatting is done for you so never use '?' just put ? and ensure the right method is used for the type of parameter.
    Remember to close the PreparedStatement and ResultSet after you have finished (in a finally clause is probably best) to avoid leaking cursors on the Database.

  • Retriving data from database through EntityBean to WebDynpro

    Dear SDN's,
    I have integrated my EJB appliaction into WebDynpro via Data Access Command Bean.
    Here is my scenario.
    1.Created a Dictionary Project,
    2.Created a EntityBean,
    In Entity Bean, i have created a finder method using the query - FindByAllAccounts
    used the EJB QL to retrieve the records from the database using the following syntax in EntityBean.
    <b><query>
         <query-method>
                 <method-name>findByAllAccounts</method-name>
                <method-params/>
       </query-method>
       <ejb-ql>select object(s) from ServiceTypeBean s</ejb-ql>
    </query></b>
    3.In Session bean, the viewAllServiceTypes method which will be invoked from within the Command Bean is called the entity bean of the local home, findByAllAccount
    Command Bean invoked the session bean, viewAllServiceTypes. It returns the resultSet dataType
    In Web Dynpro, add the code shown below in the QueryAll button and also, the EAR file is added to the Web Dynpro as a sharing reference
    After the execution of my WebDynpro,
    it returns no records. It should return 2 records. I dont know where it goes wrong.
    Correct me if anything is worng here.
    Here what my doubt is, the return of the Entity bean and Session Bean is Collection type.
    If i store the retrieved records in collection Object like vector, how can i differentiate each record to display as individual.
    anyway I tried by converting the Collection Object to ResultSet.
    Here is the code in the command Bean,
    public ResultSet execute1()
    Collection col=new Vector();
    ResultSet rs=null;
    try{
    col=theSrType.viewAllServiceTypes();
    rs=(ResultSet) col.iterator();
    }catch(Exception e){
    e.printStackTrace();
    return rs;
    I am just calling the execute1() method in my Webdynpro program.
    I know here something is wrong but my aim is to retireve set of records from database via Entity bean to display in WebDynpro Table.
    Your help will be appreciated.
    Regards,
    Sireesha.B

    For helper class you have to create a separate java project.
    Auxillary class is required to store the data from the entity bean  in a form that can be displayed.
    For this purpose, the auxillary class must contain a field for each relevant value. The fields will be named similar to their definition in the entity bean.
    For example:Entity Bean has persistent fields id, firstname, lastname.
    Auxillary Class should contain all these fields and getter and setter method to access these fields.
    In your EJB module project give this auxillary class project reference.
    In the session bean parse the collection of Entitty Bean local references and convert it to collection of auxillary class reference.
    In the command bean  declare a collection type variable,  write getter and setter methods for this variable, call the session bean method and assign it declared collection type variable.You dont need to write any logic inside command bean method.
    Go through this URL for more information.
    <a href="http://help.sap.com/saphelp_erp2005vp/helpdata/en/70/13353094af154a91cbe982d7dd0118/frameset.htm">http://help.sap.com/saphelp_erp2005vp/helpdata/en/70/13353094af154a91cbe982d7dd0118/frameset.htm</a>
    Message was edited by:
            Monalisa Biswal

  • Failed to retrive data from database

    Hi.
    I have a layut in Crystal.
    This report uses 2 views. PrintOinvHeader and PrintInv1Lines
    when i use fields from first view everything is ok.
    When i add line form view 2'nd to the report i have this error and next one
    Canot detremine the queries necessary to get data from this report

    Hi. there are those scripts
    USE [BAZA2]
    GO
    /****** Object:  View [dbo].[PrintInv1Lines]    Script Date: 04/05/2011 14:50:44 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE VIEW [dbo].[PrintInv1Lines]
    AS
    SELECT     t0.DocEntry, t0.ItemCode, t0.Dscription, t0.Price, t0.PriceBefDi, t0.PriceAfVAT, t0.DiscPrcnt, t0.LineTotal, t0.LineVat, t0.Currency, t0.VatSumFrgn, t0.LineVatlF,
                          t0.VatGroup, t0.VatPrcnt, t0.unitMsr
    FROM         dbo.INV1 AS t0 INNER JOIN
                          dbo.OITM AS t1 ON t1.ItemCode = t0.ItemCode
    WHERE     (t0.DocEntry = 4500)
    USE [BAZA2]
    GO
    /****** Object:  View [dbo].[PrintOinvHeader]    Script Date: 04/05/2011 14:50:35 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE VIEW [dbo].[PrintOinvHeader]
    AS
    SELECT     t0.DocEntry, t0.DocNum, t0.DocDate, t0.TaxDate, t0.DocDueDate, t1.CardCode, t1.CardName, t2.PymntGroup, t0.ObjType, t0.Address, t1.LicTradNum
    FROM         dbo.OINV AS t0 INNER JOIN
                          dbo.OCRD AS t1 ON t1.CardCode = t0.CardCode INNER JOIN
                          dbo.OCTG AS t2 ON t2.GroupNum = t0.GroupNum
    WHERE     (t0.DocEntry = 4500)

  • How save & retrive data from database using flex, coldfusion, sql server

    hi , i am very new in flex, i am trying to insert data in
    database using flex2, coldfusion, sql server. any one can help me
    please. or give me any example.

    Hi try to goto the following sites, you will get some
    direction to think
    http://weblogs.macromedia.com/pent/archives/2006/11/example_of_flex.cfm
    http://pdxphp.org/node/258
    Good Luck

  • Fetching data from a table and displaying it on the text box

    Hi,
    I have created a dialog program in which created a container(text box)  to enter data upto 1000 characters.
    Iam capturing the data and storing it in a custom table. In PBO I want to fetch data from my custom table (if data is already present :1000 characters data) and display it on screen.
    Please let me know how do i do it?

    hii Pavani,
    declare this two sttements in Screen
    MODULE STATUS_DATA.
    MODULE SELECT_DATA.
    In PBO, Under SELECT_DATA write Select query like:
    (considering the DB field to be text and Screen Field to be SC_TEXT)
    select text from <DB Table> into SC_TEXT where <condition>.
    *note if u r selecting more than one field than write fields in (   ),eg. (f1....f2) )
    Plz let me know for  any further queries.
    Regards,
    Apoorv

  • Getting the last selected value of the combo  - very very urgent...........

    On my panel i have a jcombobox in upper half(which displays say the address type.) and few text fields on the lower half(which displays the add details). when the user selects a value in the combo box the text fields are populated based on the selection. The user can change the values displayed in the text fields. So before setting the new values in the text fields the last displayed values need to be saved.
    I have an ActionListener for my combo which gives me the currently selected value by calling getSelecetdItem()
    How can i get the last selcted value of the combobox without using any variable of my own.

    To update the last displayed details(the address details say) i need to check what type of address the combo had previousely.....
    when i display the panel first time the home address is set by default and i have a variable to hold this value..as the user changes the selection i update the variable...I don't want to use this variable..instead if i can get the last selcted value from the event that would be great...
    thanks

  • Retrieving Data from database to combobox

    Hi
    Can anyone help in retrieving data from database to combobox..
    All the names of employees and their designations are stored in database.so i want retrieve them in other page.
    both designation and names of employees are comboboxes.
    after loading tha page i need to get all the designations which are stored in database in first combobox and when i select a particular designation i need get all tha names of employees of that designation in other combobox.this has to be done using jsp and ajax.
    please can anyone give me the code for this using Ajax and Jsp.

    Hello Friend try this code
    dbdata.jsp
    <%@page language="java" import="java.sql.*"%>
    <html>
    <%
    Class.forName("..........");
    Connection n=DriverManager.getConnection ("....","...","...");
    Statement st=con.createStatement();
    ResultSet rs=st.executeQuery("select ename from emp");
    %>
    <body>
    <form>
    <select>
    <%
    while(rs.next())
    %>
    <option><%=rs.getString("ename")%></option>
    <%
    %>
    </select>
    </form>
    </body>
    </html>

  • Swing Applet in JSP: problem with fetching data from database

    i am facing a problem while fetching data from database using Swing Applet plugged in a JSP page.
    // necessary import statements
    public class NewJApplet extends javax.swing.JApplet {
    private JLabel jlblNewTitle;
    private Vector vec;
    public static void main(String[] args) {
    JFrame frame = new JFrame();
    NewJApplet inst = new NewJApplet();
    frame.getContentPane().add(inst);
    ((JComponent)frame.getContentPane()).setPreferredSize(inst.getSize());
    frame.pack();
    frame.setVisible(true);
    public NewJApplet() {
    super();
    initGUI();
    private void initGUI() {
    try {
    this.setSize(542, 701);
    this.getContentPane().setLayout(null);
    jlblTitle = new JLabel();
    this.getContentPane().add(jlblTitle);
    jlblTitle.setText("TITLE");
    jlblTitle.setBounds(197, 16, 117, 30);
    jlblTitle.setFont(new java.awt.Font("Dialog",1,20));
    jlblNewTitle = new JLabel();
    this.getContentPane().add(jlblNewTitle);
    Vector vecTemp = getDBDatum(); // data fetched fm DB r stored here.
    jlblNewTitle.setText(vecTemp.get(1).toString());
    jlblNewTitle.setBounds(350, 16, 117, 30);
    jlblNewTitle.setFont(new java.awt.Font("Dialog",1,20));
    } catch (Exception e) {
    e.printStackTrace();
    }//end of initGUI()
    private Vector getDBDatum() {
    // fetches datum from oracle database and stores it in a vector
    return lvecData;
    }//end of getDBDatum()
    }//end of class
    in index.jsp page i have included the following code for calling this applet:
    <jsp:plugin type="applet" code="NewJApplet.class" codebase="applets"
    width="600" height="300">
    <jsp:fallback>Could not load applet...</jsp:fallback>
    </jsp:plugin>
    if i view it in using AppletViewer it runs perfectly and display the data in JLabel. (ie, both jlblTitle and jlblNewTitle).(ie, DATA FETCHES FROM db AND DISPLAYS PROPERLY)
    BUT IF I CLICK ON INDEX.JSP, ONLY jlblTitle APPEARS. jlblnNewTitle WILL BE BLANK(this label name is supposed to fetch from database)
    EVERY THING IS DISPAYING PROPERLY EXCEPT DATA FROM DATABASE!!!
    i signed the applet as follows :
    grant {
    permission java.security.AllPermission;
    Can any body help me to figure out the problem?

    This is the Swing Applet java code
    import java.awt.Dimension;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Vector;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.JScrollPane;
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTree;
    import javax.swing.ScrollPaneConstants;
    import javax.swing.SwingConstants;
    public class HaiApplet extends javax.swing.JApplet {
         private JLabel     jlblTitle;
         private JLabel     jlblNewTitle;
         private Vector     vec;
         * main method to display this
         * JApplet inside a new JFrame.
         public static void main(String[] args) {
              JFrame frame = new JFrame();
              NewJApplet inst = new NewJApplet();
              frame.getContentPane().add(inst);
              ((JComponent)frame.getContentPane()).setPreferredSize(inst.getSize());
              frame.pack();
              frame.setVisible(true);
         public HaiApplet() {
              super();
              initGUI();
         private void initGUI() {
              try {               
                   this.setSize(542, 701);
                   this.getContentPane().setLayout(null);
                        jlblTitle = new JLabel();
                        this.getContentPane().add(jlblTitle);
                        jlblTitle.setText("OMMS");
                        jlblTitle.setBounds(197, 16, 117, 30);
                        jlblTitle.setFont(new java.awt.Font("Dialog",1,20));
                        jlblTitle.setHorizontalAlignment(SwingConstants.CENTER);
                        jlblTitle.setForeground(new java.awt.Color(0,128,192));
                        jlblNewTitle = new JLabel();
                        this.getContentPane().add(jlblNewTitle);
                        Vector vecTemp = getDBDatum();
                        jlblNewTitle.setText(vecTemp.get(1).toString());
                        jlblNewTitle.setBounds(350, 16, 117, 30);
                        jlblNewTitle.setFont(new java.awt.Font("Dialog",1,20));     
              } catch (Exception e) {
                   e.printStackTrace();
         }//end of initGUI()
         private Vector getDBDatum() {
              Vector lvecData = new Vector(10,5);
              Connection lcon = null;
              Statement lstmt = null;
              ResultSet lrsResults = null;
              String lstrSQL = null;
              String lstrOut = null;
              try {
                   OmmsDBConnect db = new OmmsDBConnect();
                   lcon = db.connectDb();
                   lstmt = lcon.createStatement(lrsResults.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                   lstrSQL = "select DT_ID from P_DATATABLES";
                   lrsResults = lstmt.executeQuery(lstrSQL);        
                   int i = 0;
                   lrsResults.last();
                   int length = lrsResults.getRow();
                   System.out.println(length);
                   lrsResults.beforeFirst();
                   int recCount = 0;
                   while (lrsResults.next()) {
                        recCount++;
                        lvecData.addElement(new String(lrsResults.getString("DT_ID")));
                   //     System.out.println("ID :  " + lrsResults.getString(1));
                        i++;
                   }System.out.println("here 3 out fm while");
              catch(SQLException e) {
                   System.out.print("SQLException: ");
                   System.out.println(e.getMessage());
              catch(Exception ex) {
                   lstrOut = "Exception Occured " + ex.getMessage();
              finally {
                   try {
                        lrsResults.close();
                        lstmt.close();
                        lcon.close();
                        System.out.println("[DONE]");
                   catch(Exception e) {
                        System.out.println(e);
             }//end of finally
              return lvecData;
         }//end of getDBDatum()
    }//end of classOfcourse the above code compiles and runs well. in Applet Viewer
    I plugged the above Swing Applet in a JSP page index.jsp
    <jsp:plugin type="applet" code="NewJApplet.class" codebase="applets"
                   width="600" height="300">
         <jsp:fallback>Could not load applet...</jsp:fallback>
    </jsp:plugin>Every thing is working fine in AppletViewer...But if i view this in any browser, then only the jlblTitle is displaying. jlblNewTitle is not displaying(this label name is actually fetching from thedatabase)
    can any body help me regarding this matter.? Thx in Advance.

  • Not able to populate data in the combo box

    Hi Guys,
    I m new to flex development and I want to populate the data
    coming from the databasein the combobox.I am able to get the length
    .but not able to populate the data.
    Can anyone helpme out?
    The code is below:
    The data displayed in the combox box is displayed as
    [object],[object] etc.I m sure that the data is coming from the
    database and its not populated in the combo box.any help is
    appreciated.
    private function getParkinfo(event:ResultEvent):void
    { Alert.show(event.result.length.toString());
    countries.dataProvider = event.result;
    <mx:ComboBox id="countries" />

    What does the data look like in the result? Is it XML? Post a
    sample of it.

  • When i change the value of a combo box using a property node it displays the value not the item label

    I am using a combo box as a select list for text serial commands.  I have items like "engineering", "GUI", and "Scan" for the commands "MDE", "MDN", and MDS respectively which i have input as the corresponding value in the combo box.  so for example the label "engineering" has the value "MDE" in the combo box items list.  when the Vi starts it needs to read the current value MDE, MDN, or MDS and then i want it to display on the front panel the item text corresponding to that command value.
    To do this i have tried to read the serial command, ie MDS and then wire that to a "value" property of a property node of the combo-box, but instead of displaying the corresponding item label, "Scan", it displays the value "MDS" on the front panel instead.  i want the front panel to use the label text when choosing and displaying but the block diagram to use the serial commands.  Can this be done with a combo box?  I'm trying to use a combo box so i can keep it all text and avoid having to build a case statement to convert enums or rings from a numerical value to the text command.
    The correct text value is wired to the value property and it does exist in the combo-box.  I have unchecked "values match items" and selected to not allow undefined values.

    Don't use the value property node.  Use the Text.Text property node.  When creating the property node, select Text, then in the next pop-up box, select Text.
    - tbob
    Inventor of the WORM Global

Maybe you are looking for