Retrieve BP's country

hi experts..
i have the following query
SELECT T0.[DocNum]'u03A4u03B9u03BCu03BFu03BBόu03B3u03B9u03BF u03A0ώu03BBu03B7u03C3u03B7u03C2',
p.Docnum'u03A4u03B9u03BCu03BFu03BBόu03B3u03B9u03BF u03A0u03C1u03BFu03BCu03B7u03B8u03B5u03B9ώu03BD',
p.docdate,
pp.CardName,c.name AS 'u03A7ώu03C1u03B1 u03A0u03C1u03BFu03BCu03B7u03B8u03B5u03C5u03C4ή',
T1.[ItemCode],p.NumAtCard,
T2.U_IntCode,
T1.[Quantity],T1.[Price],T1.[LineTotal],(T2.[BWeight1]*T1.[Quantity]) as 'u0392άu03C1u03BFu03C2 u0393u03C1u03B1u03BCu03BCήu03C2'
FROM OINV T0
  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
  INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
  left outer join PCH1 pr on pr.ItemCode=T2.ItemCode and not exists
     (select 1 from pch1 w where w.docentry>pr.docentry and
                 w.itemcode=pr.itemcode)
  left outer join opch p on pr.docentry=p.docentry
  left outer join ocrd pp on pp.CardCode=coalesce(p.CardCode,T2.Cardcode)
  left outer join crd1 s1 on s1.CardCode=pp.CardCode and s1.Adrestype='B'
         and s1.Linenum=(select min(w.linenum) from crd1 w
     where w.CardCode=pp.CardCode and w.Adrestype='B'
      and w.country is not null)
  left outer join ocry c on c.code=s1.country
WHERE T0.DocNum = '1501244'
and i am interested in adding one more column that will include the origin(country) of the  BP
as far as you can see in the above query, i bring up the origin of the last invoice(opch) and i need one more
do you have any idea?
thanks in advance for your time!

With this new column you get the country of the prefared vendor too:
SELECT T0.[DocNum]'A/R inv',
T1.[visorder] InvLine,
p.Docnum'A/P inv',
pp.CardName,c.name,C2.name,
T1.[ItemCode],p.NumAtCard,
T2.U_IntCode
FROM OINV T0
  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
  INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
  left outer join PCH1 pr on pr.ItemCode=T2.ItemCode and not exists
     (select 1 from pch1 w where w.docentry>pr.docentry and
       w.itemcode=pr.itemcode)
  left outer join opch p on pr.docentry=p.docentry
  left outer join ocrd pp on pp.CardCode=coalesce(p.CardCode,T2.Cardcode)
  left outer join crd1 s1 on s1.CardCode=pp.CardCode and s1.Adrestype='B'
         and s1.Linenum=(select min(w.linenum) from crd1 w
     where w.CardCode=pp.CardCode and w.Adrestype='B'
      and w.country is not null)
  left outer join ocry c on c.code=s1.country
  left outer join crd1 s2 on s2.CardCode=T2.CardCode and s2.Adrestype='B'
         and s2.Linenum=(select min(w.linenum) from crd1 w
     where w.CardCode=T2.CardCode and w.Adrestype='B'
      and w.country is not null)
  left outer join ocry c2 on c2.code=s2.country

Similar Messages

  • html:select : put each collection of country names in each user session?

    Hi,
    I have different <html:select> elements in my JSP. The options are filled with collections (country list, city list...).
    What is the best way to do for country for example? To retrieve all the country name from the database, put it in a arrayList for EACH user session. Or, put it in an application element?

    If it's not going to change for users, I'd store it in the application scope. No point to having multiple copies of the same information.

  • How to do it in VC

    Hi Everyone,
    I have a How to do in VC question and need your help:
    there is a summary level table on top of page and details on the bottom. If I click on a different row on the summary table, the details will be changed based on the row you click on.
    Can anyone please tell me how to do this in VC or provide me any documentation?
    Thanks a lot,
    Jin Freda

    You have to place a BAPI between the two tables . Connect the first table OUT port to BAPI's IN port , connect the OUT port of BAPI to IN port of the second form(detailed table).
    if its a JDBC data service then you have to do some more mappings so that the related data is retrieved from the table.
    Say you have two data services(JDBC table) called Country and City , now in your case your first data service is Country and the second data service is City.
    The model looks like this
    Country (JDBC table data service) -
    VC TABLE -
    City (JDBC table data service) -
    VC TABLE
    1)Retrieve data from Country data service (JDBC table ) and display it in VC Table.
    2)Connect the OUT port of TABLE to IN port of City Data Service(jdbc table)
    3) Select the connector that connects the IN port of CITY data service and Country VC TABLE , click configure.
    4) Map the fields , save and run.
    Hope this answers your question.

  • Spatial query inside the exists clause return ora-13226

    The following does not work:
    select b.state, b.county from counties b where exists
    (select 's' from states a where a.state = 'New Jersey'
    and mdsys.sdo_relate (b.geom, a.geom, 'mask=INSIDE querytype=WINDOW' ) = 'TRUE');
    ERROR at line 1:
    ORA-13226: interface not supported without a spatial index
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 8
    ORA-06512: at "MDSYS.SDO_3GL", line 302
    ORA-06512: at line 1
    The following does work:
    select b.* from states a,
    counties b where a.state = 'New Jersey'
    and mdsys.sdo_relate (b.geom, a.geom, 'mask=INSIDE querytype=WINDOW') = 'TRUE';
    I found bug 1243095 telling that this is not a bug but a limitation of the spatial operator. It cannot be invoked on a table that is not spatially indexed. In fact, the table is indexed but oracle cannot find the spatial index because table b(counties) is declared outside the EXISTS clause.
    In my case, I use object table. I cannot use the workaround specified above because I should use the DISTINCT clause but I cannot define the MAP and ORDER function (this is a general query).
    I've found another workaround :
    select b.state, b.county from counties b where exists
    (select 's' from states a where a.state = 'New Jersey'
    and mdsys.sdo_relate (a.geom, b.geom, 'mask=CONTAINS querytype=WINDOW') = 'TRUE');
    but sdo_relate still doesn't use the spatial index of table b (even if I specify it explicitely in the operator) and the query is very slow (more than 15 minutes).
    Is there a better workaround ?

    OK but I work in object model.
    And if I don't use the EXISTS clause, I must use the distinct clause.(I used the exists because of that)
    If I will to retrieve all the country that have at least a state beginning with the C letter, I will wrote :
    select c.* from country c, table(c.states) s where s.column_value.name like 'C%';
    (It is a simplified request to express the problem)
    In this case, I must use the distinct clause to select one occurence of each country objet (one country may contains more than one state beginning with C).
    select distinct c.* from country c, table(c.states) s where s.column_value.name like 'C%';
    For that, I must define a MAP or ORDER function for EACH type used in the country object.
    My first question is : I must retrieve all different country objects. Why the request doesn't use the MAP or ORDER function of the country type to distinct them ? Is there another syntax (or a hint) to express that ?
    In this case, it will make an ORA-00932 : incoherent datatype because the type of the nested table column cannot contain map or order method.
    Any suggestion ?
    Thanks in advance.

  • Execute SQL query in JavaBean

    I want to execute SQL query in the JavaBean.
    Is there any problem in the following code.
    There is no error message, but the database do not update. And I try to use JSP , it is ok. What is the problem in JavaBean ??
    How to execute SQL in JavaBean ???
    Please help ! Thank you !
    test.jsp - call UserTrace.java
    UserTrace.java - execute SQL
    Code:
    ** test.jsp **
    <%@ page language="java" contentType="text/html" %>
    <%@ page import="user.*, java.util.*" %>
    <jsp:useBean id="usertrace" class="user.UserTrace" scope="session" />
    <%
    if (session.isNew())
         session.setAttribute("usertrace", usertrace);
         session.setMaxInactiveInterval(15);
    %>
    ** UserTrace.java **
    package user;
    import java.util.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.beans.*;
    import java.sql.*;
    import user.*;
    public class UserTrace implements javax.servlet.http.HttpSessionBindingListener {
         private Connection con = null;
         Statement stmt = null;
         ResultSet rs = null;
         String sql;
         public void valueBound(HttpSessionBindingEvent event) {
         public void valueUnbound(HttpSessionBindingEvent event) {
              try {
                   Class.forName("org.gjt.mm.mysql.Driver");
                   con = DriverManager.getConnection("jdbc:mysql://localhost/test?user=abc&password=abcd");
                   stmt = con.createStatement();
                   sql = "insert into list(username, session_id) values ('mary', 'xxxxxxxxx')";
                   int count = stmt.executeUpdate(sql);
              catch (ClassNotFoundException e) {
              catch (SQLException e) {
    }

    Hi,
    U can use the following code:
    /********** IMPORTING PACKAGES AND CLASSES *******/
    // General package id
    package id;
    //Import the Vector class as this bean handles Vector.
    import java.util.Vector;
    //Import the SQL class to create the connections,statement,resultset etc.,
    import java.sql.*;
    //Import the SQL Types to call the setNull Method.
    import java.sql.Types.*;
    /* Main Class */
    public class dataBean
    /*********** Global Declarations ********/
    // To create the connection object
    Connection con;
    // To create the Statement object
    Statement stmt;
    // To create the PreparedStatement object
    PreparedStatement psmt;
    // To Handle the ResultSet
    ResultSet rs;
    // Most of the method need to hold the querystring for which qryString variable declare globally.
    String qryString=null;
    /************ METHODS **************/
    /* To set the connection object
         con - Connection object
    public void setConnection(Connection con)
    try
         this.con = con;
         catch(Exception e)
    /* insertRecord with column type argument
    tblNameString - Name of the Table
         dataVector - vector contains the values according to the table order
         eg., element(0) has first field, element(1) has second field vice versa
         colType - String array contains type of all the fields.                    
    return true -     if record inserted successfully
         fase - if insertion fails                    
    public boolean insertRecord(String tblNameString,Vector dataVector,String colType[])
    boolean sucFlag=false;
    try
    String commaString = "";
    int fieldCount = dataVector.size();
    for (int i=0;i<fieldCount-1;i++)
    commaString +="?,";
    commaString+="?";
    if (fieldCount > 0)
    qryString = "insert into "+tblNameString+" values ("+commaString+")";
    psmt = con.prepareStatement(qryString);
    for(int i=0;i<colType.length;i++)
    if (colType.equals("I"))
    psmt.setInt(i+1,Integer.parseInt(dataVector.elementAt(i).toString()));
    else if (colType[i].equals("F"))
    psmt.setFloat(i+1,Float.parseFloat(dataVector.elementAt(i).toString()));
    else if (colType[i].equals("S") || colType[i].equals("D"))
    psmt.setString(i+1,dataVector.elementAt(i).toString());
    else if (colType[i].equals("IN")||colType[i].equals("FN"))
    psmt.setNull(i+1,java.sql.Types.NUMERIC);
    else if (colType[i].equals("SN"))
    psmt.setNull(i+1,java.sql.Types.VARCHAR);
    else if (colType[i].equals("DN"))
    psmt.setNull(i+1,java.sql.Types.DATE);
    int sucCnt = psmt.executeUpdate();
              if (sucCnt > 0) sucFlag=true;
    catch(Exception e)
    return sucFlag;
    /* insertRecord without column type argument
    tblNameString - Name of the Table
         dataVector - vector contains the values according to the table order
         eg., element(0) has first field, element(1) has second field vice versa
    return true -     if record inserted successfully
         fase - if insertion fails                    
    public boolean insertRecord(String tblNameString,Vector dataVector)
    boolean sucFlag=false;
    Vector colType = getColumnType(tblNameString);
    try
    String commaString = "";
    int fieldCount = dataVector.size();
    for (int i=0;i<fieldCount-1;i++)
    commaString +="?,";
    commaString+="?";
    if (fieldCount > 0)
    qryString = "insert into "+tblNameString+" values ("+commaString+")";
    psmt = con.prepareStatement(qryString);
    for(int i=0;i<colType.size();i++)
    if (colType.elementAt(i).toString().equals("I"))
              if (dataVector.elementAt(i)==null||dataVector.elementAt(i).toString().equals(""))
         psmt.setNull(i+1,java.sql.Types.NUMERIC);
                   else               
         psmt.setLong(i+1,Long.parseLong(dataVector.elementAt(i).toString()));
    else if (colType.elementAt(i).toString().equals("F"))
              if (dataVector.elementAt(i)==null||dataVector.elementAt(i).toString().equals(""))
         psmt.setNull(i+1,java.sql.Types.NUMERIC);
                   else               
         psmt.setDouble(i+1,Double.parseDouble(dataVector.elementAt(i).toString()));
    else if (colType.elementAt(i).toString().equals("S"))
              if (dataVector.elementAt(i)==null||dataVector.elementAt(i).toString().equals(""))
              psmt.setNull(i+1,java.sql.Types.VARCHAR);
                   else               
         psmt.setString(i+1,dataVector.elementAt(i).toString());
    else if (colType.elementAt(i).toString().equals("D"))
              if (dataVector.elementAt(i)==null||dataVector.elementAt(i).toString().equals(""))
         psmt.setNull(i+1,java.sql.Types.DATE);
                   else               
         psmt.setString(i+1,dataVector.elementAt(i).toString());
    int sucCnt = psmt.executeUpdate();
              if (sucCnt > 0) sucFlag=true;
    catch(Exception e)
    return sucFlag;
    /* insert particular fields
    tblNameString - Name of the Table
         dataVector - vector which contains the values according to the table order
         eg., element(0) has first field, element(1) has second field vice versa
         colType - String array contains type of all the fields.                    
    return true -     if record inserted successfully
         fase - if insertion fails                    
    public boolean insertRecordPart(String tblNameString,Vector dataVector,String colType[])
    boolean sucFlag=false;
    String fieldString=" ";
    try
    String commaString = "";
    int fieldCount = dataVector.size();
    for (int i=0;i<(fieldCount/2)-1;i++)
    commaString +="?,";
    commaString+="?";
    if (fieldCount > 0)
         String valueString[]= new String[fieldCount];
         for (int i=0,j=0;i<fieldCount;i+=2,j++)
                   fieldString=fieldString+dataVector.elementAt(i)+",";
                   valueString[j]=dataVector.elementAt(i+1).toString();
              if (fieldString.substring(fieldString.length()-1,fieldString.length()).equals(","))
              fieldString=fieldString.substring(0,fieldString.length()-1);
    qryString = "insert into "+tblNameString+"("+fieldString+") values ("+commaString+")";
    psmt = con.prepareStatement(qryString);
              for (int i=1,j=0;i<fieldCount;i+=2,j++)
    if (colType[j].equals("I"))
              if (dataVector.elementAt(i)==null||dataVector.elementAt(i).toString().equals(""))
         psmt.setNull(j+1,java.sql.Types.NUMERIC);
                   else               
         psmt.setInt(j+1,Integer.parseInt(dataVector.elementAt(i).toString()));
    else if (colType[j].equals("L"))
              if (dataVector.elementAt(i)==null||dataVector.elementAt(i).toString().equals(""))
         psmt.setNull(j+1,java.sql.Types.NUMERIC);
                   else               
         psmt.setLong(j+1,Long.parseLong(dataVector.elementAt(i).toString()));
    else if (colType[j].equals("F"))
              if (dataVector.elementAt(i)==null||dataVector.elementAt(i).toString().equals(""))
         psmt.setNull(j+1,java.sql.Types.NUMERIC);
                   else               
         psmt.setFloat(j+1,Float.parseFloat(dataVector.elementAt(i).toString()));
    else if (colType[j].equals("DB"))
              if (dataVector.elementAt(i)==null||dataVector.elementAt(i).toString().equals(""))
         psmt.setNull(j+1,java.sql.Types.NUMERIC);
                   else               
         psmt.setDouble(j+1,Double.parseDouble(dataVector.elementAt(i).toString()));
    else if (colType[j].equals("S"))
              if (dataVector.elementAt(i)==null||dataVector.elementAt(i).toString().equals(""))
              psmt.setNull(j+1,java.sql.Types.VARCHAR);
                   else               
         psmt.setString(j+1,dataVector.elementAt(i).toString());
    else if (colType[j].equals("D"))
              if (dataVector.elementAt(i)==null||dataVector.elementAt(i).toString().equals(""))
         psmt.setNull(j+1,java.sql.Types.DATE);
                   else               
         psmt.setString(j+1,dataVector.elementAt(i).toString());
    int sucCnt = psmt.executeUpdate();
              if (sucCnt > 0) sucFlag=true;
    catch(Exception e)
    return sucFlag;
    /* Get Column Type of require table fields
    tblNameString - Name of the table
    return vector which contains the column types of the desired table
    public Vector getColumnType(String tblNameString)
    int colCount = 0;
         String locString="";
         Vector colVector = new Vector();
    try
         qryString = "select DATA_TYPE from user_tab_columns where table_name=? ORDER BY COLUMN_ID";
    psmt = con.prepareStatement(qryString);
         psmt.setString(1,tblNameString.toUpperCase());
         rs = psmt.executeQuery();
         while (rs.next())
         colCount = rs.getMetaData().getColumnCount();
              for(int i=1;i<=colCount;i++)
              locString = rs.getString(i);
              colVector.addElement(locString.equals("DATE")?"D":locString.equals("NUMBER")?"F":locString.equals("VARCHAR2")?"S":locString.equals("VARCHAR")?"S":"");
         rs.close();
         catch(Exception e)
         return colVector;
    /* update record
    tblNameString - Name of the Table
         dataVector - vector which contains the values according to the table order
         eg., element(0) has first field, element(1) has second field vice versa
         colType - String array contains type of all the fields.                    
         return true - if record successfully updated
         false - if Update fails
    public boolean updateRecord(String tblNameString,Vector dataVector,String colType[],String whereString)
    boolean sucFlag=false;
    String fieldString=" ";
    try
    String commaString = "";
    int fieldCount = dataVector.size();
    for (int i=0;i<fieldCount-1;i++)
    commaString +="?,";
    commaString+="?";
    if (fieldCount > 0)
         String valueString[]= new String[fieldCount];
         for (int i=0,j=0;i<fieldCount;i+=2,j++)
                   fieldString=fieldString+dataVector.elementAt(i)+"=?,";
                   valueString[j]=dataVector.elementAt(i+1).toString();
              if (fieldString.substring(fieldString.length()-1,fieldString.length()).equals(","))
              fieldString=fieldString.substring(0,fieldString.length()-1);
    qryString = "update "+tblNameString+" set "+fieldString+" "+whereString;
    psmt = con.prepareStatement(qryString);
    for(int i=0,vectorPos=1;i<colType.length;i++,vectorPos+=2)
    if (colType[i].equals("I"))
              if (dataVector.elementAt(vectorPos)==null||dataVector.elementAt(vectorPos).toString().equals(""))
              psmt.setNull(i+1,java.sql.Types.NUMERIC);
                   else               
              psmt.setInt(i+1,Integer.parseInt(dataVector.elementAt(vectorPos).toString()));
    else if (colType[i].equals("L"))
              if (dataVector.elementAt(vectorPos)==null||dataVector.elementAt(vectorPos).toString().equals(""))
              psmt.setNull(i+1,java.sql.Types.NUMERIC);
                   else               
              psmt.setLong(i+1,Long.parseLong(dataVector.elementAt(vectorPos).toString()));
    else if (colType[i].equals("F"))
              if (dataVector.elementAt(vectorPos)==null||dataVector.elementAt(vectorPos).toString().equals(""))
              psmt.setNull(i+1,java.sql.Types.NUMERIC);
                   else               
              psmt.setFloat(i+1,Float.parseFloat(dataVector.elementAt(vectorPos).toString()));
    else if (colType[i].equals("DB"))
              if (dataVector.elementAt(vectorPos)==null||dataVector.elementAt(vectorPos).toString().equals(""))
              psmt.setNull(i+1,java.sql.Types.NUMERIC);
                   else               
              psmt.setDouble(i+1,Double.parseDouble(dataVector.elementAt(vectorPos).toString()));
    else if (colType[i].equals("S"))
              if (dataVector.elementAt(vectorPos)==null||dataVector.elementAt(vectorPos).toString().equals(""))
              psmt.setNull(i+1,java.sql.Types.VARCHAR);
                   else               
              psmt.setString(i+1,dataVector.elementAt(vectorPos).toString());
    else if (colType[i].equals("D"))
              if (dataVector.elementAt(vectorPos)==null||dataVector.elementAt(vectorPos).toString().equals(""))
              psmt.setNull(i+1,java.sql.Types.DATE);
                   else               
              psmt.setString(i+1,dataVector.elementAt(vectorPos).toString());
    int sucCnt = psmt.executeUpdate();
              if (sucCnt > 0) sucFlag=true;
    } // end of if
    } // end of try
    catch(Exception e)
         return false;
         return sucFlag;
    public ResultSet getResultSet(String selectString)
         try
              stmt = con.createStatement();
              rs = stmt.executeQuery(selectString);
         catch(Exception e)
         System.out.println(e.getMessage());
         finally
         return rs;
    /* Get Query Result
    selectString - Query
    return the result vector based on the querystring
    public Vector getResultVector(String selectString)
         Vector resVector = new Vector();
         try
              stmt = con.createStatement();
              rs = stmt.executeQuery(selectString);
              while (rs.next())
              resVector.addElement(rs.getString(1));
              resVector.addElement(rs.getString(2));
         catch(Exception e)
         System.out.println(e.getMessage());
         finally
         return resVector;
    /* return next consecutive number
    tablenName - Name of the table for which the number to be generated
         serialFiel - Name of the field for which the number to be generated
         whereString - where condition to filter the records if composite key found,
                        it can be empty if there is no composite primary key.
    startNumber - if there is no record exists in the table, set the starting number
    public String getCurrentSerial(String tableName,String serialField,String whereString,String startNumber)
    String queryString = "select max(to_number("+serialField+")) from "+tableName+" "+whereString;
    int maxSerial=0;
    try
    psmt = con.prepareStatement(queryString);
         rs = psmt.executeQuery();
         while (rs.next())
              maxSerial = rs.getInt(1);
         if (maxSerial < 0)
         maxSerial=Integer.parseInt(startNumber);
         else
              maxSerial+=1;
         rs.close();
    catch(Exception e)
    return String.valueOf(maxSerial);
    /* return next consecutive number
    tablenName - Name of the table for which the number to be generated
         serialFiel - Name of the field for which the number to be generated
         whereString - where condition to filter the records if composite key found,
                        it can be empty if there is no composite primary key.
         Note : if there is no record exists in the table, it starts with 1
    public String getCurrentSerial(String tableName,String serialField,String whereString)
    String queryString = "select max(to_number("+serialField+")) from "+tableName+" "+whereString;
    int maxSerial=0;
    try
         stmt = con.createStatement();
         rs = stmt.executeQuery(queryString);
    while (rs.next())
              maxSerial = rs.getInt(1);
         if (maxSerial < 0)
         maxSerial=1;
         else
              maxSerial+=1;
         rs.close();
    catch(Exception e)
    System.out.println("Error from max serialX:"+e.getMessage());
    return String.valueOf(maxSerial);
    /* return the currnent user name */
    public String getCurrentUser()
    Statement stmt=null;
    ResultSet rs=null;
    String queryString = "select user from dual";
    String userName = "";
    try
    stmt = con.createStatement();
         rs = stmt.executeQuery(queryString);
         while (rs.next())
              userName = rs.getString(1);
         rs.close();
    catch(Exception e)
    return userName;
    /* return current user along with server's current date
    example : userName#today
    public String getCurrentUserDate()
    Statement stmt=null;
    ResultSet rs=null;
    String queryString = "select user,to_char(sysdate,'dd-mon-yyyy') from dual";
    String userName = "";
    String todayDate= "";
    try
    stmt = con.createStatement();
         rs = stmt.executeQuery(queryString);
         while (rs.next())
              userName = rs.getString(1);
                   todayDate = rs.getString(2);
         rs.close();
    catch(Exception e)
    return userName+"#"+todayDate;
    /* return server's current date */
    public String getCurrentDate()
    Statement stmt=null;
    ResultSet rs=null;
    String queryString = "select to_char(sysdate,'dd-mon-yyyy') from dual";
    String todayDate= "";
    try
    stmt = con.createStatement();
         rs = stmt.executeQuery(queryString);
         while (rs.next())
                   todayDate = rs.getString(1);
         rs.close();
    catch(Exception e)
    return todayDate;
    /* return true if atleast one record found in the table
         tblName : Name of the table
         whereString : Where condition to filter the records
    public boolean isRecordExists(String tblName,String whereString)
    String queryString = "select count(1) from "+tblName+" "+whereString;
    boolean recFound = false;
    try
    stmt = con.createStatement();
         rs = stmt.executeQuery(queryString);
         while (rs.next())
         if (rs.getInt(1)==0)
                        recFound = false;
                   else
                        recFound = true;
         rs.close();
    catch(Exception e)
    return recFound;
         // round off decimal Places
    public String fixDecimal(String sourceString,int digits)
    String tmpText="",decimalPart="",returnText="";
    try
    sourceString = String.valueOf(Double.parseDouble(sourceString));
    tmpText = sourceString.substring(sourceString.indexOf(".")+1);
         if (tmpText.length() > digits)
         decimalPart = tmpText.substring(0,digits);
    if (Integer.parseInt(tmpText.substring(digits,digits+1))>=5)
         decimalPart = String.valueOf(Integer.parseInt(decimalPart)+1);
         tmpText = decimalPart;      
         if (decimalPart.length() > 3) // to check wheter 1000 reached, if yes add 1 to actual text      
              returnText = String.valueOf(Integer.parseInt(sourceString.substring(0,sourceString.indexOf(".")))+1);
         else
                   returnText = sourceString.substring(0,sourceString.indexOf("."))+"."+tmpText;
         else // if user entered decimal is with in 3 digits
         if (tmpText.equals("0"))
                   returnText = sourceString.substring(0,sourceString.indexOf("."));
              else               
                   returnText = sourceString.substring(0,sourceString.indexOf("."))+"."+tmpText;
    catch(Exception e)
    System.out.println(e.getMessage());
    return sourceString;
    System.out.println(returnText);
    return returnText;
    } // end of main class
    Access this Bean in JSP as follows:
    <%@ page language="java" %>
    <%@ page import="java.util.*"%>
    <%@ include file="../connectionSetup.jsp"%>
    <jsp:useBean id="dataBeanObj" class="id.dataBean"/>
    <html>
    <head>
         <title>ADDRESS MASTER FORM</title>
    <style type="text/css">      
    .tData
         font-family : sans-serif;
         font-size : 9px;
         font-weight : bolder;
         color : navy;
    .buttonStyle
         font-family : sans-serif;
         font-size :10px;
    </style>
    </head>
    <%
    dataBeanObj.setConnection(con);
    String curCode="";
         String consFld = request.getParameter("consfld")==null?"":request.getParameter("consfld");
         String cat = request.getParameter("cat")==null?"a":request.getParameter("cat").equals("a")?"a":"u";
    boolean updateFlag=false,isWrongCountry=false;
    String code="";
         String name="";
         String add1="";
         String add2="";
         String add3="";
         String state="";
         String country="";
         String zip="";
         String am_pcouncode="";
         String am_pareacode="";
         String am_psubcode="";
         String am_fcouncode="";
         String am_fareacode="";
         String am_fsubcode="";
         String am_phone="";
         String am_fax="";
         String email="";
         String notes="";
         String telex="";
         String mobile="";
         String popup="";
         code = request.getParameter("code")==null?"":request.getParameter("code");
         name = request.getParameter("name")==null?"":request.getParameter("name");
         popup = request.getParameter("popup")==null?"":request.getParameter("popup");
         String submitMode = request.getParameter("submit_mode")==null?"":request.getParameter("submit_mode");
         String editMode = request.getParameter("edit_hidden")==null?"null":request.getParameter("edit_hidden");
         if (name != null && !submitMode.equals("yes")) // ready to retrieve records
         if (!code.equals(""))
              rs = dataBeanObj.getResultSet("select am_code code,am_name name,am_address_1 add1,am_address_2 add2,am_address_3 add3,am_country country,am_state state,am_zip zip,am_phone phone,am_fax fax,am_e_mail email,am_notes notes,am_telex telex,am_mobile mobile from id_vms_address_master where am_code='"+code+"'");
              else
              rs = dataBeanObj.getResultSet("select am_code code,am_name name,am_address_1 add1,am_address_2 add2,am_address_3 add3,am_country country,am_state state,am_zip zip,am_phone phone,am_fax fax,am_e_mail email,am_notes notes,am_telex telex,am_mobile mobile from id_vms_address_master where upper(am_name)='"+name.toUpperCase()+"'");
         if (rs.next()) // if record found
              code = rs.getString("code");          //     retrieve code
              name = rs.getString("name");          //     retrieve name
              add1 = rs.getString("add1");          //     retrieve address 1
              add2 = rs.getString("add2");          //     retrieve address 2
              add3 = rs.getString("add3");          //     retrieve address 3
              country = rs.getString("country");          //     retrieve country
              state = rs.getString("state");          //     retrieve state
              zip = rs.getString("zip");          //     retrieve zip
              am_phone = rs.getString("phone");          //     retrieve phone
              am_fax = rs.getString("fax");          //     retrieve fax
              email = rs.getString("email");          //     retrieve email
              notes = rs.getString("notes");          //     retrieve notes
              telex = rs.getString("telex");          //     retrieve telex number
              mobile = rs.getString("mobile");          //     retrieve mobile number
         else if (submitMode.equals("yes")) // ready to submit
              code = request.getParameter("code");          //     get the input code
              name = request.getParameter("name");          //     get the input name
              add1 = request.getParameter("address1");     //     get the input address 1
              add2 = request.getParameter("address2");     //     get the input address 2
              add3 = request.getParameter("address3");     //     get the input address 3
              country = request.getParameter("country");     //     get the input country
              state = request.getParameter("state");          //     get the input state
              zip = request.getParameter("zip");          //     get the input zip
              am_pcouncode = request.getParameter("pcouncode");          //     get the input phone country code
              am_pareacode = request.getParameter("pareacode");          //     get the input phone area code
              am_psubcode = request.getParameter("psubscode");          //     get the input phone subscriber code
              am_fcouncode = request.getParameter("fcouncode");          //     get the input fax country code
              am_fareacode = request.getParameter("fareacode");          //     get the input fax area code
              am_fsubcode = request.getParameter("fsubscode");          //     get the input fax subscriber code
              am_phone = am_pcouncode+"-"+am_pareacode+"-"+am_psubcode;
              am_fax = am_fcouncode+"-"+am_fareacode+"-"+am_fsubcode;
              telex = request.getParameter("telex");          //     get the input telex
              mobile = request.getParameter("mobile");     //     get the input mobile
              email = request.getParameter("email");          //     get the input email
              notes = request.getParameter("notes");          //     get the input notes
              String colType[] = {"S","S","S","S","S","S","S","S","S","S","S","S","S","S"};
              Vector vec = new Vector();
              if (cat.equals("u"))
                   vec.addElement("am_code");          vec.addElement(code);          //     add code to vector element
              else
              curCode = dataBeanObj.getCurrentSerial("id_vms_address_master","am_code","");
                   vec.addElement("am_code");          vec.addElement(curCode);          //     Next Serial Generation
              vec.addElement("am_name");          vec.addElement(name);          //     add name to vector element
              vec.addElement("am_address_1");     vec.addElement(add1);          //     add address 1 to vector element
              vec.addElement("am_address_2");     vec.addElement(add2);          //     add address 2 to vector element
              vec.addElement("am_address_3");     vec.addElement(add3);          //     add address 3 to vector element
              vec.addElement("am_country");     vec.addElement(country);     //     add country to vector element
              vec.addElement("am_state");          vec.addElement(state);          //     add state to vector element
              vec.addElement("am_zip");          vec.addElement(zip);          //     add zip to vector element
              vec.addElement("am_phone");          vec.addElement(am_phone);          //     add phone to vector element
              vec.addElement("am_fax");          vec.addElement(am_fax);          //     add fax to vector element
              vec.addElement("am_e_mail");          vec.addElement(email);          //     add email to vector element
              vec.addElement("am_notes");          vec.addElement(notes);          //     add notes to vector element
              vec.addElement("am_telex");          vec.addElement(telex);          //     add telex to vector element
              vec.addElement("am_mobile");          vec.addElement(mobile);          //     add mobile to vector element
              if (dataBeanObj.isRecordExists("id_country_master"," where country_code='"+country+"'"))
                   if (cat.equals("u"))
                        // update the records
                        updateFlag = dataBeanObj.updateRecord("id_vms_address_master",vec,colType,"where am_code='"+code+"'");
                   else
                        // insert record
                        updateFlag = dataBeanObj.insertRecordPart("id_vms_address_master",vec,colType);
                   else
                        isWrongCountry=true;               
    %>
    The connectionSetup.jsp is as follows:
    <%@ page import="java.sql.*" %>
    <%@ page import="javax.sql.*" %>
    <%@ page import="javax.naming.*" %>
    <%@ page import="allaire.taglib.*" %>
    <%
         Connection con=null;
         PreparedStatement ps = null;
         Statement stmt=null;
         ResultSet rs=null;
    try
         String jrunDSN = null, lookupDSN = null;
         jrunDSN = request.getParameter("dsnvalue") == null ? "vms_test" : request.getParameter("dsnvalue");
         lookupDSN     = "java:comp/env/jdbc/" + jrunDSN;
         InitialContext ctx     = new InitialContext();
         DataSource     dsn      = (DataSource)ctx.lookup(lookupDSN);
         try
              if (application.getAttribute("connectionapplication") == null)
                   con = dsn.getConnection();
                   application.setAttribute("connectionapplication",con);
              else
              con = (Connection) application.getAttribute("connectionapplication");
         stmt = con.createStatement();
         catch(Exception e)
              con = dsn.getConnection();
              application.setAttribute("connectionapplication",con);
    catch(Exception e)
         out.println("<font face='arial' size='2'><center>Problem with database connection. Please contact your administrator</center></font>");
    %>
    In Connection setup.jsp u can change as u need.
    This is thru JNDI. This works fine for us in our projects.
    Bye.

  • Establish connection with database to send/receive data through Xcelsius

    Hi
    Iu2019m working on a Xcelsius project that requires to establish 2 way communication with the SQL server.
    2 way communication requirement: When user selects an option (country) from the accordion component, it needs to send that to database as a query and retrieves that particular country data onto Xcelsius and refresh the chart data accordingly.
    Iu2019m thinking of using ASPX to communicate between Xcelsius and the SQL server, but not sure how to proceed.
    Appreciate if anyone can provide instructions or pointers to where I can get started with it
    Thanks,
    Malik

    Malik,
    I had worked on a similar requirement, where Sql server should be integrated with Xcelsius and should retrieve real time data.
    Here is what we did...
    -->Configured web service on SQL server side (you will find plenty of doc related to this on google)
    -->Configured Web Service connection in Xcelsius (by passing the WSDL url generated from the SQL server)
    -->Developed dashboard in Xcelsius which retrieves data from SQL server realtime i.e. when user passes Variable value through a component (Combo box or anything), then this value in inturn passed to webservice, and then this web service will retrieve the data to Xcelsius.
    Hope this helps...
    -Anil

  • Viewing all thumbnails in a folder?

    I want to be able to look at all the thumbnails of images in a folder which in itself contains several sub-folders, rather than having to go into each subfolder to view the images. Is this possible? Elements 11.

    ddwddw1 wrote:
    many thanks, now for another dumb question, how do I asign a common tag?
    Not a dumb question, really. (Your original question was not)
    When you create a folder which is meant to hold several subfolders, it's because all the subfolders will have a common property.
    Of course, using date based folders and subfolders is totally superfluous in the Organizer : the dates are entered in the database automatically and you can select any period with the usual tools.
    Say your want to create a 'vacation' master folders with many subfolders by countries. If you think 'properties' instead of file location, you'll assign a keyword 'vacation' and another one for each country for each import batch. Easy to retrieve either by country or simply by vacation. Easy to apply the 'vacation' or 'country' to a whole batch of pictures at import time. There are several convenient workflows to maintain a coherence between the tags and the folder structure; they rely on the tagging of pictures in a subfolder at import time instead of tagging after the folder tree has been created.
    In a situation where tagging has not been applied at import time, you can create the common tag ('vacation') and apply it successively to all files of each subfolder. It's quicker than one can imagine.
    We can discuss the choice of keeping a coherence between folder structure and database structure, there are pros and cons. But if you decide to be coherent while taking advantage of the advantages of the database tagging, you should keep both systems coherent at import time. Much less work afterwards.

  • Import License Check for Return Orders

    Hello,
    We are currently testing compliance for return orders in sales.
    We would like to check the import license for these orders.
    For this we have defined a separate legal regulation and assigned the combination country of plant (= legal unit) and country of departure to it.
    When we process the return order the GTS system can not retrieve the correct country of departure.
    to check available import licenses.
    Does this has something to do with the incorrect determination of the partner function for returns.
    I suppose that we need a function for inbound movements : goods supplier, vendor ?
    Thanks for your support
    Regrds
    Frank

    Hi,
    What Iam going to tell is not advisable but if  you want you can do this.
    1)Go to T.code:OVAH
    2) Select the message :229
    3) Select Application : V4
    After selecting the above message and application----towards on the Right hand side "Change the Message category from Waring to Error".
    After doing the above setting--when ever the user tries to give more quantity in Return order when referenced from Invoice---""System will give error message" and does not allow to give more Quantity when referenced from the Invoiced quantity.
    Regards
    SK

  • How to use JComboBox as VB DataCombo?

    I wan't to know if it is possible to use a JComboBox as VB6 DataCombo.
    There are 3 main properties of the VB6 DataCombo component: BoundColumn, ListField and RowSource.
    For example I can set the rowsource of this component to be a recordset containing for the first field a country code and the second field the corresponding country name. Therefore the BoundColumn will be the country code and the list field the country name. This component will display the country name and I am able to retrieve the corresponding country name. Also when I set to country code to this component, the corresponding country name is displayed.
    Is it possible to have the same behaviour with a JComboBox or do I have to use another component?
    Thanks for your help.

    Hi, you are probably long gone ...but I would like to set the record straight.
    After coming back and reading this post again I realized I my memory was a bit foggy about what a VB bound column property was doing. In fact, you DON'T need a CellRenderer to do this, because a CellRenderer is used to manipulate the visible aspect of the cell, and that has nothing to do with the VB bound column concept. I went into Access and reminded myself what VB is using the bound value for ...which is to store an additional value for each cell in the combo, apart from the value that will be displayed in each cell. This value is used to 'bind' the combo to a database query where the invisible 'bound column' value is a primary key value that is used to lookup the rest of the row for that selection. Of course in VB this all happens behind the scenes when you choose to fill the combo from a database query.
    In Java, unless you want to build an entire wizard to match the one in VB, you don't really approach the problem that way. You are going to have to do your own JDBC routine to fill the combo ...then listen for selections on that combo ...and query new values from the database each time the selection changes. However, you could give yourself a bit of leverage by considering the following two approaches.
    First off, you could ...as you read in the combo values from the db ...just add your own special data object into the combo that holds TWO values instead of just putting in the single visual object into the combo.
    //Loop through db results getting both the primaryKey
    //column values and the visible column values...
    mycombo.addItem( (Object) new MySpecialDataObject(primaryKey,visibleValue) );Your class for MySpecialDataObject could be something like this:
    public class MySpecialDataObject {
      private String primaryKey;
      private String visibleValue;
      public MySpecialDataObject(String primKey, String visVal) {
        primaryKey = primKey;
        visibleValue = visVal;
      public String getPrimaryKey() { return primaryKey; }
      public String getVisibleValue() { return visibleValue; }
    }And then when you get the selected object just cast it back into your special type, and then you can access both the primaryKey and the visibleValue for the selection. You can then requery the db using the primaryKey instead of having to use only the visible combo cell value.
    //Inside your action event for the combobox...
    MySpecialDataObject dao = (MySpecialDataObject) mycombo.getSelectedItem();
    String sql = "SELECT * FROM a_table WHERE primKey = " + dao.getPrimaryKey();However, this kind of forces the work onto the application developer to make this one (or possibly many of these) little data capsules each time they are using the combo. Another alternative could be to go to the data model for the combo, and create your own custom subclass that adds the characteristics you are looking for to the combobox itself, relieving the app developer of this minor nuisance. It might be a bit more work up front ...but it will streamline your development in the future by providing a customized combo class for your dev's to use.
    Here is an example of doing just that. The comments cover most of what I have done and why ...I did this over the weekend as my penance for giving you bad advice regarding the Cell renderer. As a bonus, I threw in an example of defining a custom cell renderer as well. Cheers ...silly old GumB.
    P.S. I am sure there are other approaches as well, good luck.
    * BoundJComboBoxModel.java
    * Created on May 23, 2003, 10:51 PM
    package com.gumbtech.ui;
    import java.util.ArrayList;
    * @author  gum
    public class BoundJComboBoxModel extends javax.swing.DefaultComboBoxModel {
      private ArrayList boundObjects = new ArrayList();
       * Above, is an ArrayList for storing the bound values for each element.
       * Below, I have overriden all three constructors from DefaultComboBoxModel.
       * Notice how the second two just create default 'bound values' equal to a
       * string representation of the elements array index integer.  This may
       * work as a default if your primary keys in the database agreed (which
       * they quite possibly could).  However, the model is not really intended
       * to be filled this way.  Instead, use the overloaded addElement method
       * (below) and provide each item and corresponding bound value as a pair.
      public BoundJComboBoxModel() {
        super();
      public BoundJComboBoxModel(Object[] items) {
        super(items);
        for(int i=0; i<items.length; i++) {
          boundObjects.add(String.valueOf(i));
      public BoundJComboBoxModel(java.util.Vector v) {
        super(v);
        for(int i=0; i<v.size(); i++) {
          boundObjects.add(String.valueOf(i));
       * This method overloads its counterpart from DefaultComboBoxModel.
       * This provides a way to add a complete element, by providing values
       * for both the display value and the bound value all at once.
      public void addElement(Object item, Object boundValue) {
        boundObjects.add(boundValue);
        super.addElement(item);
       * Here are the new methods that 'decorate' the original DefaultComboBoxModel.
       * They provide ways to set and get the bound value for a specific element.
       * The method setBoundValueAt is called from the gui when we fill the combo.
       * The method getBoundValueAt is called from the BoundJComboBox class that
       * we are going to build next. It could be called directly on the model, but
       * making a special JComboBox class that used this model seemed a little nicer.
       * You will see the JComboBox class that uses this model next in the example.
      public void setBoundValueAt(int index, Object boundValue) {
        boundObjects.set(index, boundValue);
      public Object getBoundValueAt(int index) {
        return boundObjects.get(index);
      public Object getBoundValueForItem(Object item) {
        int index = getIndexOf(item);
        return boundObjects.get(index);
       * These methods override thier counterparts from DefaultComboBoxModel.
       * They are overriden so we can keep the bound value list in sync.
       * For example, consider the original addElement method from the superclass.
       * Used when no bound value is provided, the method will add a bound value
       * equal to a string representation of the elements array index integer.
       * The other two overriden methods are self explanatory.
      public void addElement(Object item) {
        int idNum = boundObjects.size();
        boundObjects.add(String.valueOf(idNum));
        super.addElement(item);
      public void removeElement(Object item) {
        int index = super.getIndexOf(item);
        boundObjects.remove(index);
        super.removeElement(item);
      public void removeAll() {
        boundObjects = new ArrayList();
        super.removeAllElements();
    * BoundJComboBox.java
    * Created on May 23, 2003, 10:00 PM
    package com.gumbtech.ui;
    import java.util.ArrayList;
    import com.gumbtech.ui.BoundJComboBoxModel;
    * @author  gum
    public class BoundJComboBox extends javax.swing.JComboBox {
       * Here, I have overriden all three constructors from JComboBox.
       * We will 'force' our custom JComboBox to use the BoundJComboBoxModel.
      public BoundJComboBox() {
        super(new BoundJComboBoxModel());
      public BoundJComboBox(Object[] items) {
        super(new BoundJComboBoxModel(items));
      public BoundJComboBox(java.util.Vector v) {
        super(new BoundJComboBoxModel(v));
       * These are the new methods that 'decorate' the original JComboBox
       * class.  We have added methods that match the two methods JComboBox
       * provides for finding elements in the models list, except that our
       * new methods access the bound value list instead of the item list.
       * I only use the getSelectedBoundValue method in this example.  I
       * provided the other because together the two make a complete match
       * to the way the original class lets you query the original model.
      public Object getSelectedBoundValue() {
        return ((BoundJComboBoxModel)this.dataModel)
                .getBoundValueAt(getSelectedIndex());
      public Object getBoundValueAt(int index) {
        return ((BoundJComboBoxModel)this.dataModel)
                .getBoundValueAt(index);
    * BoundComboTest.java
    * Created on May 24, 2003, 12:18 PM
    package com;
    import java.awt.Color;
    import com.gumbtech.ui.BoundJComboBox;
    import com.gumbtech.ui.BoundJComboBoxModel;
    import com.gumbtech.ui.MyCustomCellRenderer;
    * This is a test gui that lets us demonstrate the custom
    * BoundJComboBox that we have created.  We are going to
    * emulate the 'bound column' characteristic of a VB bound
    * combo box object.
    * @author  gum
    public class BoundComboTest extends javax.swing.JFrame {
      public final static String T = "    ";
      private BoundJComboBox boundJComboBox;
      private javax.swing.JLabel msgLbl;
       * The constructor just calls methods that
       * build the gui and then fill the combo box.
      public BoundComboTest() {
        initComponents();
        fillCityComboByProvince("Alberta");
       * This method just sets up the gui components for our example.
      private void initComponents() {
      //Create an instance of BoundJComboBox (our customized JComboBox).
        boundJComboBox = new BoundJComboBox();
      //Plug in a custom renderer for the element cells visual appearance.
      //I put this here so you can see what a CellRenderer does, but this
      //actually plays no part in creating our VB like bound column combobox.
      //Out of interest, you can look at the MyCustomCellRenderer class later on.
        boundJComboBox.setRenderer(new MyCustomCellRenderer(new Color(40,100,60)));
      //Listen for change events on the combo box with an action listener.
      //Inside this action (see the comboActionPerformed method below) lies
      //the real reason for needing the bound column value.  The action needs
      //to translate the combo selection into a database query that retrieves
      //the values to be used on the form that this combo box is controlling.
        boundJComboBox.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            comboActionPerformed(evt);
      //Create other stuff to host our combo box in (irrelevent to our example).
        msgLbl = new javax.swing.JLabel();
        setTitle("Bound Combo Example");
        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            System.exit(0);
        getContentPane().add(boundJComboBox, java.awt.BorderLayout.NORTH);
        getContentPane().add(msgLbl, java.awt.BorderLayout.CENTER);
        pack();
        java.awt.Dimension screenSize =
           java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setSize(new java.awt.Dimension(400, 200));
        setLocation((screenSize.width-400)/2,(screenSize.height-200)/2);
       * So, your 'bound' combo box needs a visual label that will be
       * displayed in the combo box, here we use city names from a db.
       * Your VB like 'bound column' is going to be the city_ID number, which is
       * the primary key we need to use to look up this cities values in other
       * tables.  Being different from the visible text label ...this value needs
       * to be stored in the special 'bound column' area of our combo box model.
      private void fillCityComboByProvince(String province) {
      //We can get the model out of our JComboBox, notice that the model is of
      //type BoundJComboBoxModel ...which is our own customized ComboBoxModel.
        BoundJComboBoxModel model = (BoundJComboBoxModel) boundJComboBox.getModel();
      //Clear out the combo so we can load it fresh  See how the methods we are
      //used to using in a regular ComboBoxModel now seamlessly handle our
      //parallel list of 'bound column' values.  That's because we over-rode
      //them appropriately in our customized BoundJComboBoxModel.
        model.removeAll();
      //Pretend this is the query we would use to get the values...
      //If we were selecting all the rows in the table, we might not need a bound
      //column bacause they may have a linear set of incrementing primary keys.
      //However, we are selecting a filtered set of cities ...only those from Alberta
      //...so the primary keys will not follow any regular pattern.  This is why the
      //'bound column' concept is used ...to hold a non-visible list of primary keys
      //that match each label in the combo box.  Even though we choose the value
      //'Calgary' in the combo ...we need to use '54' to look it up in the database.
        String sql = "SELECT name, city_ID FROM cities WHERE province = "+ province;
      //Pretend this is the results from our query to the db.
        final Object[] cityNames = {"Calgary", "Edmonton", "Lethbridge", "Red Deer"};
        final Object[] primaryKeys = {"54", "89", "101", "193"};
      //Use the overloaded addElement method we created in BoundJComboBoxModel to
      //fill the combo with both the visual text value, and the 'bound' value.
        for(int i=0; i<cityNames.length && i<primaryKeys.length; i++) {
            model.addElement(cityNames, primaryKeys[i]);
    //See, the combo box now has a 'bound column' for each visual element in
    //its list, which we will use to query the db each time the selection changes.
    //This is all your 'bound column' is doing in your VB wizard ...except you
    //never see the code for it. In Java, you just write the code to give your
    //JComboBox this behaviour ...and more if you so choose (which is really
    //the whole the point here!)
    * The next method handles the selection change event for our combo box.
    * This is where you use the 'bound value'. You use it to requery
    * the db so you can fill in your form with new values each time
    * the combobox selection is changed by the user.
    * This method is your action event for the combo ...and it is doing
    * the same thing that your VB program will do with your 'bound column'
    * in your VB combo box. In VB you just can't see the code, that's all.
    private void comboActionPerformed(java.awt.event.ActionEvent evt) {
    //Get the combobox that performed the action event...
    boundJComboBox = (BoundJComboBox) evt.getSource();
    //If we had a database here for real, we would query for our new form
    // values using the 'bound column' value as the primary key in the query.
    //This is what it means to use the 'bound column' of a VB combobox or list.
    //Its just a value for each element in the combo box that is different from
    //the value that will be displayed in the combo list. That's all it means.
    //VB just uses the bound value to query the database, so we can do that too.
    String sql =
    "SELECT * FROM cities WHERE city_ID = " +
    boundJComboBox.getSelectedBoundValue();
    //Since we don't really have a db, I'll just show the values for the element.
    String msg = "<html><font color=#006666>"+
    T +"Index Selected : "+ boundJComboBox.getSelectedIndex() +"<br>"+
    T +"Value Selected : "+ boundJComboBox.getSelectedItem() +"<br>"+
    T +"Bound Column Value: "+ boundJComboBox.getSelectedBoundValue() +"<br>"+
    T +"</font><font color=#dd3366>"+ sql +"</font></html>";
    msgLbl.setText(msg);
    public static void main(String args[]) {
    new BoundComboTest().show();
    * MyCustomCellRenderer.java
    * Created on May 23, 2003, 9:21 PM
    package com.gumbtech.ui;
    import java.awt.Color;
    import javax.swing.JList;
    import javax.swing.DefaultListCellRenderer;
    * usage:
    * String[] data = {"one", "two", "free", "four"};
    * JList dataList = new JList(data);
    * dataList.setCellRenderer(new MyCustomCellRenderer());
    * @author  I think this structure and the comments are a variation of
    *          David Flanagans example from Java Examples 2. (O'Reilly)
    public class MyCustomCellRenderer extends DefaultListCellRenderer {
      private static Color selectedColor = new Color(240,99,99);
      private static Color selectedBG = new Color(163,186,168);
      public MyCustomCellRenderer() {
      public MyCustomCellRenderer(Color selectedColor) {
        this.selectedColor = selectedColor;
       * This is the only method defined by ListCellRenderer.
       * We just reconfigure the Jlabel each time we're called.
      public java.awt.Component getListCellRendererComponent(
             JList list,
             Object value,   // value to display
             int index,      // cell index
             boolean iss,    // is the cell selected
             boolean chf)    // the list and the cell have the focus
         * The DefaultListCellRenderer class will take care of
         * the JLabels text property, it's foreground and background
         * colors, and so on.
        super.getListCellRendererComponent(list, value, index, iss, chf);
         * We additionally set the JLabels color properties here,
         * but only for the cell that is currently selected (highlighted).
        if(iss) {
          setForeground(selectedColor);
          this.setBackground(selectedBG);
        return this;

  • Trying to trigger a servlet from .jsp page on combo box change

    I have a jsp page with two combo boxes ( single select ).
    Here's a snippet from the jsp page containing the code for the two combo boxes:
    <form name="frmCountry" id="frmCountry" method="POST">
         <select name="selCountry" id="selCountry">
              <jsp:include page="/country" />
         </select>
    </form>
    <form name="frmCity" id="frmCity" method="POST">
         <select name="selCity" id="selCity">
              <jsp:include page="/city" />
         </select>
    </form>
    "country" and "city" are both mapped to servlets in the web.xml file
    The country servlet successfully connects to the database and retrieves all countries
    and populates the country combo box.
    However, the populating of the city combo box depends on what country
    is selected in the country combo box;
    Here is a snippet of my code from the City servlet:
    ResultSet rs;
    rs = statement.executeQuery("SELECT City.countryID, City.id, City.name " +
                   "FROM City " +
                   "WHERE City.countryID = ( Country id ) " +
                   "ORDER BY City.name");
    Where ( Country id ) has to be somehow retrieved from the Country combo box
    on the jsp page. Country id is actually the "value" property of each <option> in the
    Country combo box. i.e.:
    <option value="5">Portugal</option>
    If it's not possible to retrieve the value property from the option,
    I could always just use the Country name
    So to reiterate, I need the City servlet to be called into action
    any time a different country is selected in the country combo box.
    I'm a newbie to jsp & servlets, so any suggestions much appreciated.
    Edited by: Irish_Fred on Jan 20, 2010 4:29 AM

    Cheers, I came up with a solution using Ajax, where I didn't have to change
    anything in my servlets and only had to make minor changes to my jsp page.
    I didn't want to use any javascript in my web app, but I guess Ajax
    has addressed the issue of cross platform independence.

  • HT5085 Purchased an Album on iTunes and now I cannot retrieve it it is no longer available in my country I want a refund

    Its bad enough That the music purchased if protected from ME Albums I purchased thinking they were safe on a cloud I can no longer Retrieve Not available in my country I think I should get a refund so I can purchase it on Amazon

    Yes your absolutely right I should have backed it up thankfully I never feel for the iTunes Match cause then I would have lost it . And thankfully there is Google Play , Amazon and several superior services .Thankfully I didn't use iCloud or the apple cloud.  I backed all my music onto Amazon  and as a safety measure Dropbox and my own cloud  ( wdex8 which failed) .
    My first desktop over 28years ago was a Macintosh floppy disk as well as my first laptop  and smartphone, routers etc all  Apple .   I Too made excuses for Apples  failures . "The next release will fix that problem" I doubt my last computer device will be made by Chinese slaves your reply set me straight. Pompous BS  My son wants the new Galaxy I argued with him tomorrow he can pick out anything he wants he not an apple picker  your on an apple try spellchecker

  • Any solution to unable to retrieve purchased apps in a new iPad - using same Apple ID, same country but different payment method.

    Any solution to unable to retrieve purchased apps in a new iPad using same Apple ID, same country but different payment mode?

    Hello there, Tag2011.
    The following Knowledge Base article offers up great information on the process of downloading a previous purchase:
    Download past purchases
    http://support.apple.com/kb/ht2519
    Particularly useful in your instance:
    Before you begin
    Sign in with the Apple ID that you used for the original purchase.
    See which Apple ID you used to download an item.
    See if the content is available for redownload. Previously purchased items might not be available if they're no longer on the iTunes Store. If you changed your Apple ID from one country to another, you can’t download items you purchased in a previous country.
    and then to download again:
    Apps
    Tap App Store.
    If you're using an iPhone or iPod touch, tap Updates, then tap Purchased.
    If you're using an iPad, tap Purchased.
    Find the item that you want to download.
    Tap the Download icon. After the app downloads, you can open it from the Home screen.
    If you can't find the item that you purchased in the iTunes Store, report a problem with the item. You can report a problem with a purchase made within the last 90 days.
    If you have a problem with an older purchase, contact iTunes Store support.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • Retrieving the Cell Site Id, Mobile Network Code, Mobile Country Code

    Hi,
    I am using CLLocationManager to retrieve the latitude/longitude of a place.Its working fine.I can also find the distance travelled between the old location and the new location.
    But I need to get the information about the Cell Site Id, Mobile Network Code, and Mobile Country Code .
    Is there any API in the SDK to retrieve them ?or any other work around that will fetch these values?
    Any suggestion or help will be appreciated.
    Thanks

    Hi and Welcome to the Community!
    Please refer to this helpful thread:
    http://supportforums.blackberry.com/t5/General-BlackBerry-Functions-and/Unlocking-your-BlackBerry-Gu...
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Find my iPad app has located my stolen iPad it is in another country how could I go about retrieving this stolen product ?

    I had my iPad stolen and find my iPad app has located it in another country is there anything I can do perhaps contact apple support in the country my iPad ended up in and would they contact police and retrieve this for me ? Surely there is something that can be done under these circumstances ?

    Thank you And I am aware of apple not getting involved although I think there should be some kind of help in these matters worldwide as Apple is multi million dollar enterprise so to set up some kind of help line for reporting these issues to countries law enforcement worldwide would be in their interest to do something as this will deter people from buying their products as indeed it has myself and in a household where there are already two iPads 3 iPhones and a Mac book air I certainly will not be upgrading my products in the future. But I kindly thank you for confirmation of what I already know. 

  • How to retrieve old purchases with the same Apple ID but from a different country

    I used to be on the US app store and purchased apps, music and books on it. Now I have changed it to a South African account but can't update apps or download my old apps onto new devices. Any advice would be appreciated.
    Thanks

    Hello JasonHatts,
    Thanks for the question. After reviewing your post, it sounds like you dont see the other country purchases. I would recommend that you read this article, it may be able to help you isolate or resolve the issue.
    Change the country of your iTunes Store, App Store, iBooks Store, and Mac App Store account - Apple Support
    After you change the country of your account, you won't see the items you purchased from the previous country’s store in the Purchased section.
    Thanks for using Apple Support Communities.
    Have a nice day,
    Mario

Maybe you are looking for

  • Getting Darker Blacks from My HP LaserJet Pro CP1525nw Color Printer

    Hi. I own an HP LaserJet Pro CP1525nw Color Printer and am on a Windows XP system. For regular printing, it works great. However, for some graphic work I am doing, I can not get the blacks to print out dark enough. I can not find any settings on the

  • RoboHelp HTML Version 10 - Navigation panel not displaying in published project

    We are generating a WebHelp project in RoboHelp HTML Version 10 and the navigation panel (TOC, Search, etc.) is no longer visible in the index file (viewed locally) and it's only visible by clicking "Show" when viewed in a web server. This issue is o

  • Problem with Community app

    I have a Nokia C2 touch&type...it have a Community app in it...after i update my phone i can't open it and it says "delete this application?"....what should i do to get it back?

  • Is it possible to have 3 email accounts logged into iCloud at the same time?

    At the moment, I can only have one logged in all the time (via the iCloud homepage), and if I want to check another email address (all mac.com addresses), I have to log off and log back in again with the password.

  • AP losing connectivity to Controller

    2602 AP loosing connectivity to 5508 running 7.4.110.0. This very well could be happening during higher traffic periods -AP has been moved to another port and even to another switch -AP was even replace with a new one -Apparently there are other APs