Direction Needed: Storing calculated values from datagrid column in order to call values into graph

Hi all,
I am new to Flex/Flash Builder, actionscript, and mxml, so please be kind.
I have developed a small program that has a component that displays a datagrid fed with information out of a mysql db via a php data services connection. Within that same component (page), I have a graph that charts the dates via a plot chart. I am interested in adding a line series to the graph, but the data I want to use is a calculated field in the datagrid which I used a custom lable function to derive and display. Can someone steer me to the correct method to store such values and how to call them into a chart?
Some addition information
Custom label function:
  /* Custom label function for the Delta1 column. Calculates the number of days between the planting date and 10% flower. */
                              private function calculateTo1stFlower(item:Object, column:GridColumn):String {
                                        var tempDate1:Date = new Date(item.dflower10 - item.dplanting);
                                        return Math.round((tempDate1.time / MS_PER_DAY) + 1).toString();
/* Number of milliseconds in a day. (1000 milliseconds per second * 60 seconds per minute * 60 minutes per hour * 24 hours per day) */
                              private const MS_PER_DAY:uint = 1000 * 60 * 60 * 24;
Within my spark datagrid
<s:GridColumn width="30" headerText="Δ1" labelFunction="calculateTo1stFlower" ></s:GridColumn>
I assume I need to store the array of values for this column and then chart the saved values as the xField within the LineSeries. Should I use a class based model?
The following link seemed like it may be an appropriate path; I am not sure though.
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7b51.html
Thanks in advance for any support,
Matthew

Thanks for trying to post DDL, but you have no idea how to do a data model. You do not know that tables have to have keys, what ISO-11179 is, etc. 
You have a table that is supposed to model companies. Your singular names says that there is only one company!  There is no company identifier (the industry standard is the DUNS). A customer is not a company. We do not use numeric data types for identifiers;
do you do math on them? NO!  The attribute property comes after the attribute name (you never heard of ISO-11179). 
Think about how silly VARCHAR(1) is. 
CREATE TABLE Companies 
(company_duns CHAR(9) NOT NULL PRIMARY KEY, 
 company_name VARCHAR(30)NOIT NULL, 
 margin_oil INTEGER NOT NULL, 
 margin_hangar INTEGER NOT NULL, 
 margin_cleaning INTEGER NOT NULL);
INSERT INTO Companies
 VALUES (1, 'AviatKorea', 100, 125, 200), 
(2, 'AXHollande', 50, 40, 30), 
(3, 'BFXNorway', 60, 80, 600), 
(4, 'EEEFrance', 10, 25, 60);
CREATE TABLE Company_Tariffs
(company_duns INTEGER NOT NULL
   REFERENCES Companies(company_duns), 
 tariff_type CHAR(1) NOT NULL
    CHECK (tariff_type IN ('A','B','C','D'),
 PRIMARY KEY (company_duns, tariff_type));
INSERT INTO Company_Tariffs values (1, 'A'), (2, 'C'), (2, 'D'), (3, 'A'), (4, 'A'), (4, 'C'), (4, 'D')
SELECT * -- do not use * in production code
  FROM Companies AS C,
       Company_Tariffs AS T 
 WHERE C.company_duns = T.company_duns;
>> I would like something like with a computed column [ ] that retrieves the different contracts used: <<
You might but a SQL programmer would not. This violated First Normal Form. It is a display report and is done in the presentation layers. 
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL

Similar Messages

  • Retrieving multiple values from one column in SELECT statement

    Hi,
    I have a slight dilemma in that I'm trying to pull down all the values from a column from a select statement that includes some JOINS in it.
    If I run the query at the SQL Plus prompt, it pulls back all the values/rows.
    When I run the select (and prepared ) statement in my JSP, it only pulls back one of the 4 values I'm trying to retrieve.
    e.g.
    at the DB level :
    SELECT role_name, CC_ID FROM votetbl a
    INNER JOIN APPROVERS b ON
    a.BUSVP = b.BUSVP AND
    a.BRANCH = b.BRANCH
    WHERE CC_ID = 1688this will return:
    ROLE_NAME CC_ID
    ops 1688
    ops 1688
    comply 1688
    legal 1688
    comply 1688
    When run in my JSP, like so:
    String primID3a = request.getParameter("primID");
    Statement stmtovoter = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
    String prepvotSQL = "SELECT role_name, CC_ID FROM votetbl a INNER JOIN APPROVERS b ON a.BUSVP = b.BUSVP AND " +
                         "a.BRANCH = b.BRANCH WHERE CC_ID = ?";
    PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
    prepvotstmt.setString(1, primID3a);
    ResultSet rest3 = prepvotstmt.executeQuery();
    rest3.next();
    String votecat = rest3.getString(1);
    out.println("Vote category: "+votecat);I only get ops returned.
    Do I need to run an enumerator? Or reqest.getParameterValues or use a while statement around the results set?
    Any feedback and direction here is welcomed!
    Thanks!

    Actually, I tried looping and still only get 1, but returned several times.
    i.e.
    PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
    prepvotstmt.setString(1, primID3a);
    ResultSet rest3 = prepvotstmt.executeQuery();
    rest3.next();
    String votecat = rest3.getString(1);
    while (rest3.next()) {
    out.print("category roles "+votecat);
    }then I get returned the following:
    admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admin
    like so.
    Where as at the DB level I get
    ROLE_NAME CC_ID
    admin 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    risk 1688
    comply 1688
    legal 1688
    legal 1688
    ops 1688
    comply 1688
    Maybe the while should go around the getString(1) designation? But I was thinking I'd tried that and gotten invalid cursor error
    Something is definitely amiss, between the prepared statement in the servlet and the SELECT statement at the DB level.
    I can totally hardcode the statement in the servlet or JSP and it will return one value potentially several times, but only one.
    Other times, it will not return a value at all, even though one resides in the db.
    Yet go to the DB/SQL Plus prompt and it returns perfectly. I can simply copy and paste the SELECT statement from the out.print line I made and it works like a champ in SQL Plus. Any ideas why the same exact thing cannot return the proper values within the servlet/JSP?
    Yeeeeeeesh!!! : (
    Message was edited by:
    bpropes20

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Get millisecond values from timestamp column in v$logmnr_contents

    Hello
    How do we get millisecond values from timestamp column in v$logmnr_contents.
    I tried with following query.
    select scn,To_Char(timestamp,'DD-MON-YYYY HH24:MI:SS:FF') from v$logmnr_contents WHERE OPERATION NOT IN('START') and username ='SCOTT' and sql_redo is not null and (seg_owner is null or seg_owner not in('SYS'));
    it says ORA-01821: date format not recognized. I want to find the relation of scn with timestamp. In forums i found, scn is derived from timestamp value. I dont know its correct or not.
    if i query with out FF in time format i get like
    scn timestamp
    808743 27-NOV-2007 00:12:53
    808743 27-NOV-2007 00:12:53
    808743 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    if scn is derived from timestamp with milliseconds, each scn should be different right?More help please

    May be there's an easy way solving your problem, I did it like that:
    CREATE TABLE quota_test (test VARCHAR2(50))
    INSERT INTO quota_test
    VALUES ('update "SCOTT"."NEWTAB1" set a="34" and b="45"')
    SELECT test normal, REPLACE(SUBSTR(test,INSTR(test,'"',1),INSTR(test,'.',1)+2),'"','') changed
    FROM quota_test
    Result is :
    NORMAL
    update "SCOTT"."NEWTAB1" set a="34" and b="45"      
    CHANGED
    SCOTT.NEWTAB1
    If you didn't understand, I can explain what I wrote

  • Reading values from lookup columns through custom workflow in SharePoint 2013

    We are able to read the values of text, number columns through custom workflow (via coding) in SharePoint 2013. However, we are not able to read values from lookup columns. So, request anyone to provide help on this.
    Thanks & regards,
    Aditya

    Hi,
    According to your post, my understanding is that you want to read values from lookup columns through custom workflow in SharePoint 2013.
    Since the workflow just doesn't get lookup fields, let's give it something static to work with instead. If we can capture the ID of the lookup field and store that as a static value in our list, the workflow can happily use that to look up our related.
    For more information, you can refer to:
    SharePoint 2013 Workflows and Lookup Columns
    Thanks,
    Linda Li                
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

  • Need to compare values in two columns of one table against values in two columns in another table

    Hi, as the title reads, I'm looking for an approach that will allow me to compare values in two columns of one table against values in two columns in another table.
    Say, for instance, here are my tables:
    Table1:
    Server,Login
    ABCDEF,JOHN
    ABCDEF,JANE
    FEDCBA,SEAN
    FEDCBA,SHAWN
    Table2:
    Server,Login
    ABCDEF,JOHN
    ABCDEF,JANE
    FEDCBA,SHAWN
    In comparing the two tables, I'd like my query to report the rows in table1 NOT found in table2. In this case, it'll be the 3rd row of table one:
    Server,Login
    FEDCBA,SEAN
    Thanks.

    create table Table1([Server] varchar(50), Login varchar(50))
    Insert into Table1 values ('ABCDEF','JOHN'),('ABCDEF','JANE'),('FEDCBA','SEAN'),('FEDCBA','SHAWN')
    create table Table2([Server] varchar(50), Login varchar(50))
    Insert into Table2 values ('ABCDEF','JOHN'),('ABCDEF','JANE'), ('FEDCBA','SHAWN')
    select [Server] ,Login from Table1
    Except
    select [Server] ,Login from Table2
    select [Server] ,Login from Table1 t1
    where not exists(Select 1 from Table2 where t1.[Server] = t1.[Server] AND Login=t1.Login)
    drop table Table1,Table2

  • Get value from table column

    Hi,
    I am new to OAF, I am trying to get the value from the table in order to make validation. I have the following PG:
    SearchResultsTableRN
    itemRow
    DetailsCell
    DetailsTableLayout
    ShortDescRow
    ShortDescCell
    ShortDesc
    LongDescRow
    LongDescCell
    LongDesc
    AttributesRow
    AttributesCell
    AttributesTableLayout
    Attributes1Row
    Attribute11Cell
    ect...
    Can anyone help me please in how to go into the table --> row --> column to retrieve the value from a specific column?
    If their is a document or example that can help I will appreciate it. Since I tried searching in devguide and didn't find any results.
    Note: I am extending the controller and reached till the following code:
    public void processFormRequest(OAPageContext oapageContext, OAWebBean webBean){
    super.processFormRequest(oapageContext, webBean);
    String event = oapageContext.getParameter("ShortDescRow");
    OATableBean advtable = (OATableBean)webBean.findChildRecursive("SearchResultsTableRN");
    OARowBean rowtbl = (OARowBean)advtable.findChildRecursive("DetailsCell");
    String message = "test:"+event+"|"+advtable+"|"+"|"+"|"+"|";
    throw new OAException(message, OAException.INFORMATION);
    Thanks and Regards
    Patrick

    Patrick,
    My first advice would be go through OAF guide and do tutorial examples, for such basic details.
    If ur talking about tablelayout region
    u can use pageContext.getParameter(<Item id of UIX bean whose value u want>);
    If you are talking about table
    You can Iterate through the VO based on primary key ...on which the table is based, and retrive the corresponding Vo attribute value.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How find out the duplicate value from each columns.

    I have below four columns,
    How can i find out the duplicate value from each columns.
    with All_files as (
    select '1000' as INVOICE,'2000' AS DELIVERYNOTE,'3000' CANDELINVOICE,'4000' CANDELIVERYNOTE from dual union all
    select '5000','6000','7000','8000' from dual union all
    select '9000','1000','1100','1200' from dual union all
    select '1200','3400','6700','8790' from dual union all
    select '1000','2000','3000','9000' from dual union all
    select '1230','2340','3450','4560' from dual
    SELECT * FROM All_files
    Output should be as per below.
    1000 2000 3000 4000
    9000 1000 1100 1200
    1200 3400 6700 8790
    1000 2000 3000 9000
    Required to check uniqueness in cross columns.
    Thanks.

    Try this (sorry about the formatting)...
    WITH all_files AS (SELECT   '1000' AS INVOICE,
                                '2000' AS DELIVERYNOTE,
                                '3000' CANDELINVOICE,
                                '4000' CANDELIVERYNOTE
                         FROM   DUAL
                       UNION ALL
                       SELECT   '5000',
                                '6000',
                                '7000',
                                '8000'
                         FROM   DUAL
                       UNION ALL
                       SELECT   '9000',
                                '1000',
                                '1100',
                                '1200'
                         FROM   DUAL
                       UNION ALL
                       SELECT   '1200',
                                '3400',
                                '6700',
                                '8790'
                         FROM   DUAL
                       UNION ALL
                       SELECT   '1000',
                                '2000',
                                '3000',
                                '9000'
                         FROM   DUAL
                       UNION ALL
                       SELECT   '1230',
                                '2340',
                                '3450',
                                '4560'
                         FROM   DUAL),
        t_base
           AS (SELECT      invoice
                        || ','
                        || deliverynote
                        || ','
                        || candelinvoice
                        || ','
                        || candeliverynote
                           str
                 FROM   all_files),
        t_str
           AS (SELECT   str || ',' AS str,
                        (LENGTH (str) - LENGTH (REPLACE (str, ','))) + 1
                           AS no_of_elements
                 FROM   t_base),
        t_n_rows
           AS (    SELECT   LEVEL AS i
                     FROM   DUAL
               CONNECT BY   LEVEL <=
                               (    SELECT   SUM (no_of_elements) FROM t_str)),
        t_build AS (SELECT   t_str.str,
                             nt.i AS element_no,
                             INSTR (t_str.str,
                                    DECODE (nt.i, 1, 0, 1),
                                    DECODE (nt.i, 1, 1, nt.i - 1))
                             + 1
                                AS start_pos,
                             INSTR (t_str.str,
                                    1,
                                    DECODE (nt.i, 1, 1, nt.i))
                                AS next_pos
                      FROM      t_str
                             JOIN
                                t_n_rows nt
                             ON nt.i <= t_str.no_of_elements),
        t_build2
           AS (SELECT   RTRIM (str, ',') AS original_string,
                        SUBSTR (str, start_pos, (next_pos - start_pos))
                           AS single_element,
                        element_no
                 FROM   t_build),
        t_build3
           AS (SELECT   single_element,
                        COUNT( * )
                           OVER (PARTITION BY single_element
                                 ORDER BY single_element)
                           ele_count
                 FROM   t_build2)
    SELECT   DISTINCT INVOICE,
                      DELIVERYNOTE,
                      CANDELINVOICE,
                      CANDELIVERYNOTE
      FROM   all_files, t_build3
    WHERE   ele_count > 1
             AND (   INVOICE = single_element
                  OR DELIVERYNOTE = single_element
                  OR CANDELINVOICE = single_element
                  OR CANDELIVERYNOTE = single_element)I think this will be faster than the previous solution?
    Cheers
    Ben
    Edited by: Munky on Feb 17, 2011 2:11 PM - "I think this will be faster than the previous solution?", nope - it's not :(

  • Need help - select data from NCLOB column problem

    Hi,
    Im having problem retrieving data from NCLOB columns via ODBC. After SQLExecdirect on my SELECT statement call to SQLFetch gives me following error:
    ORA-24806 LOB form mismatch
    I tried following two ways of data retrieval:
    SQLExecDirect(hstmt,(SQLTCHAR*)szSQLStatement,SQL_NTS);
    SQLBindCol(hstmt,3,SQL_C_TCHAR,chBuffer,sizeof(chBuffer),&iDataLen);
    SQLFetch(hstmt);
    OR
    SQLExecDirect(hstmt,(SQLTCHAR*)szSQLStatement,SQL_NTS);
    SQLFetch(hstmt);
    SQLGetData(hstmt,3,SQL_C_TCHAR,chBuffer,sizeof(chBuffer),&iDataLen);
    Both times call to SQLFetch gives me ORA-24806 LOB form mismatch error.
    INSERT and UPDATE for this table works just fine.
    If I change NCLOB type to CLOB works just fine, but I will be storing Unicode data, so using CLOB cant be a solution
    Any ideas appreciated.
    Thanks in advance,
    Vlad
    Server:
    Oracle 9.2 database on Windows 2000 Server
    NLS_LANGUAGE = AMERICAN
    NLS_TERRITORY = AMERICA
    NLS_CHARACTERSET = WE8MSWIN1252
    NLS_NCHAR_CHARACTERSET = AL16UTF16
    Client:
    Unicode C++ application, connects via Oracle 9.2 ODBC driver on Windows XP
    NLS_LANG = AMERICAN_AMERICA.WE8MSWIN1252
    CREATE TABLE my_nclob_table (
         id number (10,0) NOT NULL ,
         name nvarchar2 (255) NOT NULL ,
         description nvarchar2 (255) NULL ,
         definition nclob NOT NULL ,
         creation date NOT NULL ,
         lastmodified date NOT NULL ,
         CONSTRAINT PK_cat_pricelist PRIMARY KEY
              id
    #define     nil NULL
    #define     null NULL
    #define     SQL_ERR(__sqlerr__)     (((__sqlerr__) != SQL_SUCCESS) && ((__sqlerr__) != SQL_SUCCESS_WITH_INFO))
    #define     STOP_IF_SQL_ERR(__sqlerr__)                                                                 \
                                                      do                                                       \
                                                           if (SQL_ERR(__sqlerr__)) goto stop_;     \
                                                      } while (false)                                                  
    void eqTestOracleLOBSelect(void)
         SQLHENV henv     = null;
         SQLHDBC hdbc     = null;
         SQLHSTMT hstmt     = null;
         SQLRETURN retcode     = SQL_SUCCESS;
         TCHAR          szSQLStatement[]     = T("select id, name, definition from mynclob_table");
         int               iFetchedRows = 0;
         TCHAR          szMsg[512];
         TCHAR          chBuffer[2049];
         SQLLEN          iDataLen = 0;
         try
              retcode = eqOpenConnectionODBC(_T("myTestDsn"),_T("user"),_T("pwd"),henv,hdbc);
              STOP_IF_SQL_ERR(retcode);
              retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
              STOP_IF_SQL_ERR(retcode);
              retcode = SQLExecDirect(hstmt,(SQLTCHAR*)szSQLStatement,SQL_NTS);
              STOP_IF_SQL_ERR(retcode);
              retcode = SQLBindCol(hstmt,3,SQL_C_TCHAR,chBuffer,sizeof(chBuffer),&iDataLen);
              STOP_IF_SQL_ERR(retcode);
                   while (retcode == SQL_SUCCESS)
                        retcode = SQLFetch(hstmt);
                        if (retcode == SQL_NO_DATA)
                             retcode = SQL_SUCCESS;
                             break;
                        STOP_IF_SQL_ERR(retcode);
                   //     retcode = SQLGetData(hstmt,3,SQL_C_TCHAR,chBuffer,sizeof(chBuffer),&iDataLen);
                   //     STOP_IF_SQL_ERR(retcode);
                        ++iFetchedRows;
         stop_:
              if (SQL_ERR(retcode))
                   MessageBox(null,_T("SQL statement execution error."),_T("Error"),MB_OK);
                   eqShowStatementError(SQL_HANDLE_STMT,hstmt,retcode);
              } else     {
                             _stprintf(szMsg,_T("SQL execution success. Fetched rows: %ld"),iFetchedRows);
                             MessageBox(null,szMsg,_T("Success"),MB_OK);
         catch(...)
              MessageBox(null,_T("Unknown exception in eqTestOracleLOBSelect"),_T("Unknown exception"),MB_OK);
         if (hstmt != null)
              SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
              hstmt = null;
         if (hdbc != nil)
              SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
              hdbc = nil;
         if (henv != nil)
              SQLFreeHandle(SQL_HANDLE_ENV, henv);
              henv = nil;
    SQLRETURN eqOpenConnectionODBC(TCHAR          *szDSN,
                                       TCHAR          *szUser,
                                       TCHAR          *szPassword,
                                       SQLHENV     &henv,
                                       SQLHDBC &hdbc)
         SQLRETURN retcode;
         henv = nil;
         hdbc = nil;
         //Allocate environment handle
         retcode = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
         STOP_IF_SQL_ERR(retcode);
         //Set the ODBC version environment attribute
         retcode = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
         STOP_IF_SQL_ERR(retcode);
         // Allocate connection handle
         retcode = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
         STOP_IF_SQL_ERR(retcode);
         // Set login timeout to 5 seconds.
         SQLSetConnectAttr(hdbc, SQL_LOGIN_TIMEOUT, (void*)5, 0);
         STOP_IF_SQL_ERR(retcode);
         retcode = SQLConnect(hdbc, (SQLTCHAR*)szDSN, SQL_NTS,
                                            (SQLTCHAR*)szUser, SQL_NTS,
                                            (SQLTCHAR*)szPassword, SQL_NTS);
    stop_:
              if (SQL_ERR(retcode))
                   MessageBox(null,_T("Connection Error."),_T("Error"),MB_OK);
                   if (hdbc != nil)
                        eqShowStatementError(SQL_HANDLE_DBC, hdbc,retcode);
                        SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
                        hdbc = nil;
                   if (henv != nil)
                        eqShowStatementError(SQL_HANDLE_ENV, henv,retcode);
                        SQLFreeHandle(SQL_HANDLE_ENV, henv);
                        henv = nil;
              } else MessageBox(null,_T("Connected."),_T("Success"),MB_OK);
         return retcode;
    void eqShowStatementError(SQLSMALLINT chHandleType, SQLHANDLE hHandle,long lErrOrig)
         SQLRETURN          nErr          = SQL_SUCCESS;
         int                    nRecNum = 1;
         SQLTCHAR          szSqlState[6];
         SQLTCHAR          szMsg[SQL_MAX_MESSAGE_LENGTH];
         SQLSMALLINT          nMsgLen;
         SQLINTEGER          nNativeError;
         while ((nErr = SQLGetDiagRec(chHandleType,hHandle,nRecNum,
                                            szSqlState, &nNativeError,
                                            szMsg, sizeof(szMsg), &nMsgLen)) != SQL_NO_DATA)
              szSqlState[5] = 0;
              MessageBox(NULL,(const TCHAR *)szMsg,_T("ODBC Error"),MB_OK);
              ++nRecNum;

    Yes, the 9.2.0.2 driver can be downloaded from OTN. I don't believe it will solve your particular problem, but it will help in general. If you don't grab the latest version, you'll probably have to chack the "Force SQL_WCHAR Support" option in the DSN configuration.
    From the help file
    "The C data type, SQL_C_WCHAR, was added to the ODBC interface to allow applications to specify that an input parameter is encoded as Unicode or to request column data returned as Unicode. The macro SQL_C_TCHAR is useful for applications that need to be built as both Unicode and ANSI. The SQL_C_TCHAR macro compiles as SQL_C_WCHAR for Unicode applications and as SQL_C_CHAR for ANSI applications."
    My first thought would be that your application is not being compiled as Unicode. If you substitute SQL_C_WCHAR for SQL_C_TCHAR when you're dealing with NCLOB columns, I suspect you'll have better luck.
    More help file
    "The SQL data types, SQL_WCHAR, SQL_WVARCHAR, and SQL_WLONGVARCHAR, were added to the ODBC interface to represent columns defined in a table as Unicode. These values are potentially returned from calls to SQLDescribeCol, SQLColAttribute, SQLColumns, and SQLProcedureColumns. In Oracle release 8.1.7.0.0 or 9.0.1.0.0, the Oracle database does not support encoding columns as Unicode. These values would not be returned from the ODBC Drivers for Oracle release 8.1.7.0.0 or for Oracle 9.0.1.0.0 databases.
    In Oracle release 9.2.0.0.0, Unicode encoding was supported for SQL column types NCHAR, NVARCHAR2, and NCLOB. In addition, Unicode encoding was also supported for SQL column types CHAR and VARCHAR2 if the character semantics were specified in the column definition.
    Starting with release 9.2.0.2.0, the ODBC Driver supports these SQL column types and maps NCHAR to the SQL data type SQL_WCHAR, NVARCHAR2 is mapped to SQL_WVARCHAR, and NCLOB is mapped to SQL_WLONGVARCHAR. The SQL CHAR column is mapped to SQL_WCHAR and the VARCHAR2 column is mapped to SQL_WVARCHAR if the character semantics are specified for the column. While the Force SQL_WCHAR Support option is still available in the 9.2.0.2.0 ODBC Driver, it is no longer required for Unicode support."
    Justin

  • Multiple values from same column in diffetent columns in same row??

    Hi all,
    I am wondering how you can display different values from the same column into different columns on same row. For example using a CASE statement I can:
    CASE WHEN CODE IN ('1', '3') THEN COUNT( ID) END as "Y"
    CASE WHEN CODE NOT IN ('1', 'M') THEN COUNT( ID) END as "N"
    Yes this will produce two columns needed but will also produce two separate records and null values for the empty's.
    Any ideas?
    Thanks

    It's not clear what you want.
    Can you post some examples as described in the FAQ: {message:id=9360002}
    As my first guess, I would think you're looking for something like...
    SQL> select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-1981 00:00:00       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-1981 00:00:00       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-1981 00:00:00       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-1981 00:00:00       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-1981 00:00:00       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000                    20
          7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-1981 00:00:00       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-1981 00:00:00        950                    30
          7902 FORD       ANALYST         7566 03-DEC-1981 00:00:00       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300                    10
    14 rows selected.
    SQL> select count(case when deptno in (10,20) then deptno end) as deptno_10_20
      2        ,count(case when deptno > 20 then deptno end) as deptno_30plus
      3  from emp;
    DEPTNO_10_20 DEPTNO_30PLUS
               8             6

  • Find duplication values from multiple columns in a big table

    Hi All,
    I am working on a 11gR2 database in linux. i want to display record that have duplicate values in 2 columns.
    1. Table Structure :-
    CREATE TABLE A
    ID NUMBER(10),
    F_NAME VARCHAR2(100 BYTE),
    L_NAME VARCHAR2(100 BYTE)
    2. Sample Data:-
    Insert into A
    (ID, F_NAME, L_NAME) Values (1,'TONY' ,'SUMIT');
    Insert into A
    (ID, F_NAME, L_NAME) Values (2,'SUMIT' ,'KEITH');
    Insert into A
    (ID, F_NAME, L_NAME) Values (3,'NORA','SMITH');
    Insert into A
    (ID, F_NAME, L_NAME) Values (4,'APRIL','TONY');
    Insert into A
    (ID, F_NAME, L_NAME) Values (5,'ROSS','TAM');
    ID F_NAME L_NAME
    1 TONY SUMIT
    2 SUMIT KEITH
    3 NORA SMITH
    4 APRIL TONY
    5 ROSS TAM
    4. My requirement is i need display IDs that it's F_NAME or L_NAME has duplication in F_NAME or L_NAME columns.
    The result should be
    ID
    1 reason: F_NAME (TONY) equals to L_NAME of record 4, L_NAME (SUMIT) equals to F_NAME of record 2
    2 reason: F_NAME (SUMIT) equals to L_NAME of record 1
    4 reason: L_NAME (TONY) equals to F_NAME of record 1
    record 3, 5 aren't in the result because there is no duplication in F_NAME or L_NAME columns for NORA,SMITH, ROSS, TAM
    The table contains 10 million records, i really need to consider the performance.
    kindly suggest me the solution

    Note: Forum members please suggest better approach to this -- below.. convert into SQL :)
    I know I will be opposed by many people in this forum for posting such in-efficient solution.
    But trying to learn along with you.. its an interesting problem which must deal with all rows vs all rows to get all combinations.
    But I am still thinking how to write it in SQL, probably will learn from this post after we receive some good SQL solution for the code what I am currently doing now.
    step 1: created a table B similar to table A and added a column reason
    CREATE TABLE B
      ID      NUMBER(10),
      F_NAME  VARCHAR2(100 BYTE),
      L_NAME  VARCHAR2(100 BYTE),
      REASON  VARCHAR2(1000 BYTE)  --- ADDED THIS
    )Definetely inefficient :(
    BEGIN
       FOR rec_outer IN (SELECT * FROM A) LOOP
          FOR rec_inner IN (SELECT * FROM A) LOOP
             IF (rec_outer.f_name = rec_inner.l_name) THEN
                UPDATE B
                   SET reason =
                             rec_outer.id
                          || ' reason: F_NAME ('
                          || rec_outer.f_name
                          || ') equals to L_NAME of record '
                          || rec_inner.id
                 WHERE b.id = rec_outer.id;
             END IF;
          END LOOP;
          FOR rec_inner IN (SELECT * FROM A) LOOP
             IF (rec_outer.l_name = rec_inner.f_name) THEN
                UPDATE B
                   SET reason =
                          reason
                          || CASE
                                WHEN reason IS NULL THEN
                                   rec_outer.id || ' reason: '
                                ELSE
                             END
                          || 'L_NAME ('
                          || rec_inner.f_name
                          || ') equals to F_NAME of record '
                          || rec_inner.id
                 WHERE b.id = rec_outer.id;
             END IF;
          END LOOP;
       END LOOP;
       COMMIT;
    EXCEPTION
       WHEN OTHERS THEN
          rollback;
          RAISE;
    END;OUTPUT:
    ID     F_NAME     L_NAME     REASON
    1     TONY     SUMIT     1 reason: F_NAME (TONY) equals to L_NAME of record 4,L_NAME (SUMIT) equals to F_NAME of record 2
    2     SUMIT     KEITH     2 reason: F_NAME (SUMIT) equals to L_NAME of record 1
    3     NORA     SMITH     
    4     APRIL     TONY     4 reason: L_NAME (TONY) equals to F_NAME of record 1
    5     ROSS     TAM     Cheers,
    Manik.
    Edited : Added rollback

  • Passing value from Report Column to Javascript

    Dear Apex wizards,
    I am a bit stuck right now with implementing a modal pop-up/iframe/javascript and this forum is my last hope to fix this issue.
    Anyway, will try to explain what I am trying to accomplish.
    What I need is: I want to have an SQL report, as a very first column I want to have an "ID" numbers from my table and I want this column to have a "Column Link" set in "Column Attributes" proper ties. The trick is, that when I click on the column link (when I run my report on Apex page) I need a JQuery modal window to pop-up where in IFrame will be another page and this page will use an "ID" from my column link URL to display data. So, basically I want to pass an "ID" value from my parent page to my child page which is displayed in iFrame of modal window.
    And here is what I have:
    1. I do have an SQL report:
    select SUBNET_ID,
           long2ip(NETWORK_ADDRESS),
           long2ip(SUBNET_MASK),
           long2ip(END_HOST),
           long2ip(START_HOST),
           MAX_HOSTS,
           long2ip(BROADCAST_IP),
           NETWORK_CLASS,
           NETWORK_SIZE,
           HOST_SIZE
    from   YC_CM_IP_SUBNETS 2. Then, in "Column Attributes" for "SUBNET_ID" a have set a "Column Link" to URL as : javascript:ViewNetworkDetails(#SUBNET_ID#); 3. Now, when I run my page and point my mice on any item in my "SUBNET_ID" column I can see that it is getting a "SUBNET_ID" number from my table and it shows it in the buttom of the browser as :javascript:ViewNetworkDetails(1);, or (2) or whatever "SUBNET_ID" is. So, that is good.
    4. And here I am getting confused, basically I have to pass a value of javascript:ViewNetworkDetails(#SUBNET_ID#);, which seems to work as it gives me correct numbers from my table, to my "ViewNetworkDetails" JavaScript function, so it can paste this value into "f?p=........." iFrame URL. Below is my Jquery Modal form script and Javascript to redirect me to my popup page (the script is in HTML Header):
    <script type="text/javascript">
    function ViewNetworkDetails(){
    var apexSession = $v('pInstance');
    var apexAppId = $v('pFlowId');
    var subnetIDNumber = document.getElementById(#SUBNET_ID#);
    $(function(){
    vRuleBox = '<div id="ViewNetworkDetailsBox" title="View Subnet Details">
    <iframe src="f?p='+apexAppId+':103:'+apexSession+'::NO:103:P103_SUBNET_ID:'+subnetIDNumber+'
    "width="875" height="500" title="View Subnet Details" frameborder="no"></iframe></div>'
    $(document.body).append(vRuleBox);
    $("#ViewNetworkDetailsBox").dialog({
                            buttons:{"Cancel":function(){$(this).dialog("close");}},
                            stack: true,
    modal: true,                            
                            width: 950,                    
    resizable: true,
    autoResize: true,
    draggable: true,
    close : function(){$("#ViewNetworkDetailsBox").remove();
                            location.reload(true); }
    </script> P.S. My assumption is, that there is a problem with this part of my scriptvar subnetIDNumber = document.getElementById(#SUBNET_ID#); where I cannot get my "SUBNET_ID" value from javascript:ViewNetworkDetails(#SUBNET_ID#); into "subnetIDNumber" variable and that is why I cannot pass it to my iFrame URL.
    P.S. P.S. the child page 103 has a "Automated Row Fetch", so it is not a problem. In addition, I did a simple test, where I had a page item "P102_Value" with some value and in my script I had instead var subnetIDNumber = document.getElementById(#SUBNET_ID#); this var subnetIDNumber = $v('P102_Value'); and it worked perfectly fine....but cannot make it working against SQL Select statement :-(
    HEEEEEEEEEEEEEELLLLLPPPP.
    Thanks

    Change your column link to send the subnet_id column's value to the function call (you mentioned it, but I m not sure if you actually did)
    javascript:ViewNetworkDetails(#SUBNET_ID#);<u>You are passing the parameter value to the function, but not defined any parameters in the function definition</u>(this is possible in JS, any extra parameters is ignored)
    So, modify the function to accept the subnet ID parameter(I am actually surprised how you missed this) and assign that parameter to variable.
    <script type="text/javascript">
    function ViewNetworkDetails(pSubnetId){
    var apexSession = $v('pInstance');
    var apexAppId = $v('pFlowId');
    var subnetIDNumber = pSubnetId;
    //rest of the code would be the same

  • Need help adding image to datagrid column

    Hi,
    Can anyone tell me how to add an image to a datagrid column?
    I have created a flex library project which contains a mxml component with a datagrid, an item renderer mxml component which rendered the image within the datagrid column depending on the value coming back from the database for that column and a folder 'assets' which hold all the images. When I add the library to my main project and call the mxml component with the datagrid an image place holder is visible in the datagrid column but not the image. However, if I take the image out of the library project and added to an 'assets' folder in the main project the image is displayed in the datagrid column.
    It looks like, even though the images are in the flex library project and only the flex library project is trying to display the images in the datagrid, the library project is looking in the main application project folder for the image.
    Does anyone know why this is happening and how to fix it?
    Thanks in advance for an help,
    Xander.

    I have tried embedding the images in my library but it still didn't work. Also I can't embed the image as I'm using the value of the column to complete the image name, for example in my mxml item renderer component I have the added the following code
    <mx:Image source="@Embed(source='assets/' + data.mycolumnvalue + '.png')" tooltip="{data.mycolumnvalue}"/>
    but nothing is displayed.

  • How to pick max value from a column of a table using cursor and iteration

    Hello Everybody
    I have a table loan_detail
    and a column in it loan_amount
    now i want to pick values from this table using cursor and then by using iteration i want to pick max value from it using that cursor
    here is my table
    LOAN_AMOUNT
    100
    200
    300
    400
    500
    5600
    700i was able to do it using simple loop concepts but when i was trying to do this by using cursor i was not able to do it .
    Regards
    Peeyush

    SQL> SELECT MAX(sal) Highest_Sal,MIN(sal) Lowest_Sal FROM emp;
    HIGHEST_SAL LOWEST_SAL
           5000        800
    SQL> set serverout on
    SQL> DECLARE
      2    TYPE tmp_tbl IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
      3    sal_tbl tmp_tbl;
      4    CURSOR emp_sal IS
      5      SELECT sal FROM emp;
      6    counter INTEGER := 1;
      7  BEGIN
      8    FOR i IN emp_sal LOOP
      9      sal_tbl(i.sal) := counter;
    10      counter := counter + 1;
    11    END LOOP;
    12    DBMS_OUTPUT.put_line('Lowest SAL:' || sal_tbl.FIRST);
    13    DBMS_OUTPUT.put_line('Highest SAL:' || sal_tbl.LAST);
    14  END;
    15  /
    Lowest SAL:800
    Highest SAL:5000
    PL/SQL procedure successfully completed.
    SQL> Even smaller
    SQL> DECLARE
      2    TYPE tmp_tbl IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
      3    sal_tbl tmp_tbl;
      4    CURSOR emp_sal IS
      5      SELECT sal FROM emp;
      6    counter INTEGER := 1;
      7  BEGIN
      8    FOR i IN emp_sal LOOP
      9      sal_tbl(i.sal) := 1;
    10    END LOOP;
    11    DBMS_OUTPUT.put_line('Lowest SAL:' || sal_tbl.FIRST);
    12    DBMS_OUTPUT.put_line('Highest SAL:' || sal_tbl.LAST);
    13  END;
    14  /
    Lowest SAL:800
    Highest SAL:5000
    PL/SQL procedure successfully completed.
    SQL> Edited by: Saubhik on Jan 5, 2011 4:41 PM

  • How do I return a value from a column based on info from neighboring columns?

    I have a table of data that looks similar to this:
    Weight
    Name
    School
    Division
    106
    Name1
    School1
    1
    106
    Name2
    School2
    2
    106
    Name3
    School3
    3
    106
    Name4
    School4
    4
    113
    Name5
    School5
    1
    113
    Name6
    School6
    2
    113
    Name7
    School1
    3
    113
    Name8
    School3
    4
    It's a very large table, so there will be multiple matches for Schools, and occasionally a few matches for Names, but there will always be only one match for a given Weight and Division.
    In a separate table, how can I get the name of the person associated with the unique weight and division?
    In my head, the formula goes" "Look in the Weight column to find 106, then look in the Division column to find 4, then return the value from the Name column." But I can't figure out the formula that will do that.
    Any thoughts?

    Hi momogabi,
    This can be easily done with an index column.
    The formula I used in your original table for the index column is:
    =A2&"-"&D2. This was filled down. The column can be hidden.
    You can see the formula in the search table. If I wanted to eliminate the index column in that table the formula would look something like:
    =INDEX('Table 1-1'::B,MATCH(A2&"-"&B2,'Table 1-1'::E,0),1)
    Hope this helps.
    quinn

Maybe you are looking for

  • How can I turn off Automatic White Balance/Correction?

    Hi, I shoot color Infra-Red images. White Balance is handled in Camera - and then in Photoshop. As a new user to Lightroom 2 - everytime I view/click on an image in the Library - the color/balance of the image changes to a deep red, and I lose all of

  • Pages refuses to open files and export

    I have become incredibly agitated as Pages will save a document then refuse to open it without any reason-does notr say it is corrupted, simply comes up with message '(doc name) cannot be opened. Also, when working on pages it has started to refuse t

  • FRM-40655 SQL Error Forced Rollback

    Hi, I am getting the following Error: Why this appears? FRM-40655 SQL Error Forced Rollback: clear form and re enter transaction. ORA-24324: service handle not initialized Madni

  • Max Sounds in Flash!

    I just wanted to know what the maximum amount of sounds that can be played simultaneously in Flash CS3 are? I know that back in MX there was a limit of 8 sounds, but I haven`t seen this limit anywhere in the documentation for Flash CS3 / AS3.  I supp

  • Connecting Snow Leopard to internet via VMWare / WinXP Mobile pendrive

    Hi there, I'm in India and to get on the internet have picked up the Tata Photon+ USB Broadband hub (pen drive dongle) which doesn't work in Mac (nothing in India seems to...) This allows me to access the internet through VMWare 3/ WinXP. It must be