Looping thru column names based on a variable value

I have an ArrayCollection with a series of columns named
price1, price2... thru to price10
I'm trying to loop thru these columns based on a variable
value, but can't figure the syntax:
for (var column:int = 1; column < 11; column++){
testPrice = myGrid.selectedItem.price(column); <-- this
doesn't work
}

Try testPrice = myGrid.selectedItem["price" + column];
Remember to test that selectedItem isn't null before you try
to assign the values.
TS

Similar Messages

  • Row Insert Failed - Column name or number of supplied values does not match

    Hi ,
    I am trying add a new field to an existing table in MSSQL and access it in portlets,
    I added the new field in the table, and making necessary updations to the accessing java code seems to look fine. but when i insert the new rwo, fails with exception listed below.
    My code tidbits is as follows.
                   System.out.println("Column Location of outsidePhysician"+ aResultSet.findColumn("outsidePhysician")); // works and returns 24
                   if (anIntake.getOutsidePhysician() != null && !(anIntake.getOutsidePhysician().equals("")))
                        System.out.println("Now Alternate Physician will be added to resultset");
                        aResultSet.updateString(24, anIntake.getOutsidePhysician());
                        aResultSet.updateString("outsidePhysician",anIntake.getOutsidePhysician());
                        System.out.println("Now Alternate Physician already added to resultset"); // also printed
                   }else{
                        aResultSet.updateString(24, "new Physician");
                        aResultSet.updateString("outsidePhysician","new Physician");
                   //NOT NULL
                   aResultSet.insertRow(); // fails here
                   System.out.println("Inserted");
    The table has the right field name too, which is proved when i retrieve the fieldno, based on field name. I tried to delete the field and removing these changes work ok..
    Any ideas would be of help
    Thanks in Advance
    Usha
    [Microsoft][SQLServer 2000 Driver for JDBC]Row insert failed. at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source) at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source) at com.microsoft.jdbc.base.BaseImplUpdatableResultSet.executeStatement(Unknown Source) at com.microsoft.jdbc.base.BaseImplUpdatableResultSet.insertRow(Unknown Source) at com.microsoft.jdbc.base.BaseResultSet.insertRow(Unknown Source) at com.microsoft.jdbcx.base.BaseResultSetWrapper.insertRow(Unknown Source) at com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.insertRow(WSJdbcResultSet.java:2181) ... 14 more Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Insert Error: Column name or number of supplied values does not match table definition. at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source) at com.microsoft.jdbc.base.BaseExce

    I haven't ever used that method of inserting rows, but from the example in the API documentation it looks to me like you have to callaResultSet.moveToInsertRow();before you callaResultSet.insertRow();Or are you just "inserting" the physician's name into existing rows of the database? If that's what you are doing then you need to callaResultSet.updateRow();Message was edited by:
    DrClap

  • [[DataDirect][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Column name or number of supplied values does not match table definition.]

    Hii ..
    need help on this ..
    This what I am doing ..
    I am using a DATAEXPORT function to export level0 data from my essbase 11.1.2.2 to Microsoft SQL 2008 tables.
    So what I did first I exported the level0 data to a flat file using DATAEXPORT and the created the SQL columns by the same  in that order only in my SQL table.
    When I run it fails with this error:
    ODBC Layer Error: [21S01] ==> [[DataDirect][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Column name or number of supplied values does not match table definition.]
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1021014)
    ODBC Layer Error: Native Error code [213]
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Error(1012085)
    Unable to export data to SQL table [dataexp]. Check the Essbase server log and the system console to determine the cause of the problem.
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1021002)
    SQL Connection is Freed
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Warning(1080014)
    Transaction [ 0x1c50001( 0x51ee7d66.0x80342 ) ] aborted due to status [1012085].
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1012579)
    Total Calc Elapsed Time for [test.csc] : [1.44] seconds
    =============================================================
    I did a simple test on my Sample.basic application then ..
    loaded the calc data to it and then used the below script to export to a flat file
    //ESS_LOCALE English_UnitedStates.Latin1@Binary
    SET DATAEXPORTOPTIONS
                    DataExportLevel "Level0";
                    DataExportOverwriteFile ON;
                    DataExportColFormat OFF;
                    DataExportDimHeader OFF;
    FIX(
                "Jan",
                "Sales",
                "Actual"
    /*DATAEXPORT "File" "," "/home/hypadmin/samtest.txt";*/
    DATAEXPORT "DSN" "Abhitest" "sample" "sa" "welcome1";
    ENDFIX
    out put as below:
    "Sales"
    "100-30","California"
    "Jan","Actual",145
    Now In sql I created only 3 columns with name Jan/Sales/Actual and when I run this script again with comments removed .. I get the same error as what I have got in my first test case with other application ..
    but when I create the columns with same name as what its in export
    Sales/100-30/Califirnia/Jan/Actual
    It created the new rows successfully ..
    So with this I think the error which I am getting with my other application might be because of the same column issue  .. but then I have created all the columns by looking at the export file only as I did in sample ..
    Any idea would be helpful ..
    Thanks
    Abhishek
    I

    First make sure you add
    DataExportRelationalFile ON;
    to your set commands it is missing
    I alwats like to also add
    DataExportColHeader dimensionName;
    so I am sure what dimension is getting put into the columns.
    Then count the number of dimensions in your outline (exclude attribute dimensions). You need at least that many columns in your table  -1 + the number of  members you will be returning as columns in the export
    Taking your example Sample basic has 5 dimensions
    Measures
    Years
    Scenario
    Product
    Market
    Since you did not specify a dataexportcolheader it took the dense dimension Scenario as the columns. Your fix statement is limiting that to one member. Doing the math
    5 -1 + 1 = 5 columns in your table which is what you found works.  Suppose you fixed on bothe Actual and budget in scenario then you would need 6 columns 5 -1 +2

  • Selectively executing a mapping rule based on a variable value

    Hi,
    I have written a mapping rule in the following format.
    case #time_unit when 'quarter' then
    logic1
    when 'month' then
    logic2
    end
    In logic1, logic2 i again have nested case statements. Variable time_unit will have a static value hard-coded given (quarter/month) by user before execution.
    So Variable time_unit need not be checked for each row that gets transformed. It hits the performance.
    I want either logic1 or logic2 to be substituted dynamically in the mapping rule window based on the variable value.
    I cannot go for 2 seperate interfaces. How can I achieve this in ODI.
    Please help me.
    Thanks!!

    Sarah,
      I'm not aware of doing other than BPM. If you want the BPM Steps, Please refer below
      Step 1 : Receive
      Step 2 : Transformation
      Step 3 : Send (Syncronous call to the target system)
      Step 4 : Switch(Check the Payload value as per your reqmt)
      Step 5 : Transformation(Switch : False ,If the payload value is not ERROR)
      Step 6 : What you wanna do ( Switch :True)
    If you want more technically, then let me know the source and target systems, I will help you to design
    the complete flow.
    Best Regards,
    raj.

  • Show or Hide fields based upon a variable value

    Hi,
    I am a rookie in the field of Acrobat. And my only question is :
    How to Circle a Form Field based upon a variable value .
    For example, If x=1, I want to circle Japan and if x=0, I want to leave it without any change.
    Please help me out. Thanks for your time and help.
    Thanks,
    Vijayvijay77.

    Hi George,
    I am pre-populating a Pdf file based upon the data submitted by the user. And I have to circle options selected in the form.
    I am writing coldfusion code to flatten, populate the form into a PDF form. The end result is the PDF generation with all the data in it.
    The data comes from the database, where I set variable values if any is selected or not.
    Thanks for your reply, I really appreciate your help.
    Vijayvijay77.

  • Column name or number of supplied values does not match table definition

    Buongiorno a tutti,
    sto cercando di inserire dei record in un database SQL, usando l'oggetto DB tools Insert data. Purtroppo però mi viene segnalato il seguente errore:
    "Exception occured in Microsoft OLE DB Provider for SQL Server: Column name or number of supplied values does not match table definition. in NI_Database_API.lvlib:Rec Create - Command.vi->NI_Database_API.lvlib:Cmd Execute.vi->NI_Database_API.lvlibB Tools Insert Data.vi"
    Il recod viene generato da Labivew usando l'oggetto concatanate string e i campi sono separati da tab. se esporto su Excel sembra tutto corretto e non ho errori. Le colonne del mio database corrispondono a quelle del record e sono tutte varchar. Vi allego la porzione di codice che genera il record.
    Suggerimenti?
    Grazie,
    Davide
    Allegati:
    db.png ‏5 KB

    Per qualche strano motivo l'editor ha convertuito la sequenza di caratteri ":" e  "D" in uno smile

  • Dynamic Change Of Column Name based On The Dashboard Prompt in OBIEE 10g

    Hi All,
    I have a dashbord prompt called "calendar date". And, my report having some columns called "Product Name", "Code", "Yest Balance", "Today Balance". Now, while displaying the report in the dashboard, instead of "Today's Balance" they want to see the date which we have selected in the promt as a column name (each time we select a date in the promt, that would appear as a field name in stead of "Today's Balance" but values will be same (should show the balance for that date).
    Please advice.
    Thanks,
    BK.

    yeah...you are correct....these are workaround ...no out of box solution.
    Take the MAR11 target example in this current month is MAR 11 is populated by a session variable which gives you always current month.
    Second using union -combined query creating a header from one report and results from other report.
    But, coming to your req.......what ever the value selected in the calendar date that should come up in the column heading. so this is not possible with variable because for date of calendar image type you can not set a presentation variable. If not you can use a REQUEST VARIABLE.
    You can try 2nd way creating 2 reports one for header other for value.
    You can choose based on your flexibility. Instead you are showing the report along with prompt. I would suggest use appropriate name as 'selected date value'.

  • Passing column names in as a variable

    I know in SQL server there is a way you can pass a variable in to the procedure and put that variable as a column name, Oracle doesn't seem to pick the variable up as a column name. Can anyone show me how with a simple select statement

    bgulcu wrote:
    I'm having a similar problem. I didn't want to open up another thread since it's related.
    Problem:
    I have 107 columns on a table. The number of columns increases almost every month.
    I have an array of columns, which I have gathered from the db. I need to pivot the whole table, but due to indefinite number of columns, it had to be dynamic sql.
    Premature Solution:
    Right now, the solution that we have runs through the array of columns and uses dynamic sql to query for every single cell to get the value. Considering that we have 1000+ rows on this table, in order to do the transformation, we send 107000+ queries which is just ugly. It works, but I don't feel comfortable about it.
    Solution:
    Since we are able to get a single row of 107 columns, why don't we gather the whole row, and get the information out from it instead of tiring up the server? The indefinite number of columns is a problem, but we have the whole list in an array, lets say feature_array. So what I want to do is to get the date from the row, ie myRow.feature_array(1), myRow.feature_array(2), ..., myRow.feature_array(i).
    I just learned that it's not possible to do it (from this thread).You just misunderstood the contents of this thread. What we said is that you can't do such things with static SQL, so you need to use dynamic sql.
    What has also been told was that using dynamic sql for such a purpose is just the result of a bad design. Use a relational table as a bi-dimensional array is not right, it is possible but it's not right for the simple reason that you need a procedural language to process the dynamic SQL that is needed to retrieve data.
    Probably on database programming there's only a rule of thumb and it says: "Maximize SQL minimize PL/SQL" (or any procedural language like java). The only exceptions to keep code in procedural language must depend on a complexity reduction determined by its use. In your case there is no complexity reduction determined by the use of a procedural language.
    In the thread on this link(Schema integrity I discussed about how to implement a solution you can use as alternative for submitting queries with variable column names.
    If you introduce parameter management in your model probably you could have your problem solved with the use of only a single SQL statement. And that may be a good designed model.
    Bye Alessandro

  • Help to extract the Column Name depending on the row values

    Hello All,
    I have a table with below format
    Table Name: Employees
    Emp Name Monday Tuesday Wednesday Thursday Friday Saturday
    John yes NULL yes yes NULL NULL
    Michael NULL yes NULL yes yes NULL
    Smith NULL yes yes NULL yes yes
    In the above I have explicitly mentioned NULL just for better understanding.
    I am trying to send an email using HTMLDB_MAIL.SEND which will have the body as following
    "John is absent on Tuesday, Friday and Saturday
    Michael is absent on Monday, Wednesday and Saturday
    Smith is absent on Monday and Thursday"
    I am trying to do this using cursor, fetching each row and matching the value with NULL. But I am not able to display the column name.
    Can somebody please help me?
    Regards,
    RS.
    Edited by: user8966924 on Jan 24, 2013 4:35 AM

    Hi,
    just use Peter's query, collect into a nested table the output and create one CLOB variable from collection to use it as a body:
    create or replace function getbodyemp
    return clob
    is
       p_body_out      clob;
       type tp_tbemp   is table of varchar2 (100);
       v_tbemp         tp_tbemp;
    begin
       -- collect the output into a nested table
       with employees as
       select 'John' Emp_Name    , 'yes' Monday, null  Tuesday, 'yes' Wednesday, 'yes' Thursday, null  Friday, null  Saturday from dual union all
       select 'Michael' Emp_Name , null  Monday, 'yes' Tuesday, null  Wednesday, 'yes' Thursday, 'yes' Friday, null  Saturday from dual union all
       select 'Smith' Emp_Name   , null  Monday, 'yes' Tuesday, 'yes' Wednesday, null  Thursday, 'yes' Friday, 'yes' Saturday from dual
       select
         e.emp_name || ' is absent on ' ||
         replace (trim( ',' from nvl2(monday,null, 'Monday')
         || nvl2(Tuesday,null, ',Tuesday')
         || nvl2(Wednesday,null, ',Wednesday')
         || nvl2(Thursday,null, ',Thursday')
         || nvl2(Friday,null, ',Friday')
         || nvl2(Saturday,null, ',Saturday')), ',', ', ') txt
       bulk collect into v_tbemp
       from
         employees e
       where
         monday          is null
         or tuesday      is null
         or wednesday    is null
         or thursday     is null
         or friday       is null
         or saturday     is null
       for i IN 1 .. v_tbemp.count
       loop
          p_body_out := p_body_out || v_tbemp(i) || chr(10);
       end loop;
       return p_body_out;
    end getbodyemp;
    select getbodyemp() from dual;
    GETBODYEMP()                                                                   
    John is absent on Tuesday, Friday, Saturday                                    
    Michael is absent on Monday, Wednesday, Saturday                               
    Smith is absent on Monday, Thursday                                            
    1 row selected.Regards.
    Al

  • Return the column names for which the row values are not null.

    Hi i m a new guy to db admin, and i need a sql script which should return column names of the particular table. and the returned column should have value (fyi - if the column has null value column name should not come in the sql o/p).
    Exmple:
    table name - A
    s.no name mark status fee
    1 aa 45 p null
    2 bb 30 null paid
    3 cc 35 p paid
    fyi -1) if i give the table name(A) and s.no (2) the o/p should be -- name,mark.
    2) if i give the tablename(A) and s.no (1) the o/p should be --- name,mark,status.
    Thanks
    Krishna.
    Edited by: user13294228 on Jun 14, 2010 10:54 PM

    BTW,
    The previous solution is for all values of the column, if you want a specific row, you can add it in where clause.
    I mean in your example, it you look like:
    SET serveroutput on;
    DECLARE
       l_cnt          NUMBER;
       l_str          VARCHAR2 (255) := '';
       l_table_name   VARCHAR2 (255) := 'YOUR_TABLE_NAME';
       l_col_cond     VARCHAR2 (255) := 'S_NO';
       l_val          NUMBER         := 1;
       CURSOR c_col
       IS
          SELECT column_name
            FROM user_tab_columns
           WHERE table_name = l_table_name;
    BEGIN
       FOR i IN c_col
       LOOP
          EXECUTE IMMEDIATE    'SELECT COUNT ('
                            || i.column_name
                            || ') FROM '
                            || l_table_name
                            || ' WHERE '
                            || l_col_cond
                            || ' = '
                            || l_val
                       INTO l_cnt;
          l_str := l_str || CASE
                      WHEN l_cnt = 0
                         THEN ''
                      ELSE i.column_name
                   END || ',';
       END LOOP;
       l_str := SUBSTR (l_str, 1, LENGTH (l_str) - 1);
       DBMS_OUTPUT.put_line (l_str);
    END;Saad,
    Edited by: S.Nayef on Jun 15, 2010 11:54 AM

  • Column hiding based on Dashboard Prompt value in OBIEE 10g

    Hi,
    Can you please let me know, whether there is any possibility of "hiding the column based on the value selected in the Dashboard Prompt".
    Your suggestions are highly appreciated.
    Thanks & Regards
    Siva

    Hi,
    Simple way to solve it.
    Steps
    1.) set presentation variable for each columns of your dashboard prompt
    2.) edit your analysis of table/pivot view ---> colums formate header in this place just keep it your presentation variable values like below
    E.x
    @{ccy}
    Then save it and then test out
    Some more reference:
    http://oraclebizint.wordpress.com/2008/01/25/oracle-bi-ee-101332-dynamic-column-headers-using-presentation-variables-sets-and-conditional-formatting
    http://total-bi.com/2011/03/obiee-dynamic-column-headings
    Thanks
    Deva
    Edited by: Devarasu on May 17, 2012 8:32 PM

  • How can i target a movie of which i set the name based on a variable?

    Hi.
    I have the attached code:
    And i want to target the imgHolder
    ; that i have just created through the while function. I mean I
    attach a movieclip from the library to which I give a name composed
    from "imgHolder"+i where i is the number of the node from the xml.
    After that i want to succesfully target the newly created
    movieclip and get it's _x so i can attach the next movieclip next
    to the previous one. After that i will have a set of function based
    on the "imgHolder"+i movieclip.
    But i need to know how to succesfully target the movieclip.
    Thanks a lot.

    use the attach code option to display code in this forum.
    otherwise, your code is altered and difficult to read.

  • Looping thru sub report based on dataset in main report.

    Hello all,
    I have a report which has few parameters and I scheduled  it to run and export in excel. This report run multiple time based on parameter value and then export the data into different excel file. 
    Here is what I'm looking for:
    1. Create a main report with temporary data set with all the parameter values.
    2. Run sub report with parameter values from main report and then export it to excel file, I assume it will help to create one single excel file with multiple tabs.
    Questions are:
    1. How I can create s dataset in main report (may be use XML as a data source) and write a query? Since I don't have access to database I cannot add a table for parameters values so I need to know how I can create a dataset with all the values
    2. Is this a right approach or there is a another way to handle it?
    Look forward for expert advice.
    Thanks,
    P

    Hi Parry2k,
    According to your description, you want to create a report with several parameters and configure subscription to send delivery the report to users, but you haven’t permission to access database.
    According to my knowledge, as long as a user can connect to a SQL Server instance, the user is able to create temporary tables, there are no special permissions. To use XML as data source, we can select XML from type drop-down list, then embed xml in dataset
    query text box.
    To set parameter values, we can create Available values and Default Values manually or create datasets for the parameter, then get values from the datasets.
    In this case, I would recommend you asking database administrator to grant permission to access database to you. Creating temporary tables is not a good approach to solve the problem.
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • How can I construct a list of text values in Table 2 from text values in Table 1:Column A, based upon a test value in Table 1:Column B?

    I am looking for a way to essentially import a select group of values from one table into another. If, for instance, I have a list of names in Column A and a list of colors in Column B, I would like to be able to compile a list of the names which coincide with each distinct color, and do so in a new table specific to that color. Probably an obvious solution, but I'm a relative newbie with Numbers and my spreadsheet experience is fairly limited so I apologize if this is embarrassingly rudimentary. Thanks in advance for any help you can give.

    You can extract a subset in a separate table by adding a helper index column to your table with the original data and using a formula in the separate table.
    But first, have you tried just using a filter on the table to view a subset of the data?  You would simply filter on a color in your Column B and would immediately see the names specific to that color in Column A.  And you could copy-paste those names elsewhere as needed.  No extra columns. No formulas. No fuss.
    SG

  • Column formatting based on grouping data value- advanced data grid

    Hello Everyone,
    I am using advanced data grid to display hierarchial data nested upto depth 4. I have to color the leaf nodes conditionally based on  the grouped column value.
    Say for Eg.,
    If the data is something like
    Company
         Manager
              Jim          $4000
              John        $3000
         Accountant
              Smith     $2000
              Sam       $3000
    I have to color Jim and John based on they being a manager. In other words, how do I get Manager and Company information for the leaf rows. The data is serial to start with and I am grouping it before displaying.
    Please let me know how this could be done.
    Thanks
    Arun

    Once htmldb.oracle.com is available again, you may have a look in my demo application:
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    In the tab section I, you will find several examples on pop-up pages. There this conditional
    displaying is included as well.
    Denes Kubicek

Maybe you are looking for

  • I defaulted input help field (pick list) but SAP CRM still asking for one

    We are running SAP CRM 7.0. Some fields as you know are dialog / pick list fields. What I mean by this is they are input help fields where you can click a little square (in sap crm 7.0) to the right of the text box and it brings up a dialog screen of

  • APEX_MAIL Send Results In A HTML Table

    Apex 3.2 I have wriiten a procedure that sends an email with data from the apex_workspace_activity_log. I would like to try and display this data in a table in the email. Has anybody done this before ? CREATE OR REPLACE PACKAGE BODY EFSAPX.p_monitor_

  • How do I make my vector character shrink well?

    I created a character in illustrator that I plan to use in animations and on the web. When I shrink the vector to the size of, for example, a small avi picture for social media, I significantly lose line quality. How can I maintain the quality of det

  • PS CS3 uns AE CS3 aktivierung auf neuem iMac nicht möglich

    ich habe einen neuen iMac 21" und die Daten von dem alten iMac migriert. Nun kann ich PS CS3 und AE CS3 nicht mehr aktivieren. Bei dem Versuch es über das Internet zu tun, kommt die Meldung "keine Verbindung". Die 7 Tage sind schon rum.. was kann ich

  • App transfer / account merging?

    My husband and I both have iPads, but are realizing it is a bit excessive to have 2 in the house. We are selling one and wanted to know if it's possible to transfer the purchased apps from one to the other? We currently have separate iTunes accounts