Using a variable to refer to an object's ID

Is there a way to replace “comboBox1” in the following line of script code with a variable which contains the text “comboBox1”?
     comboBox1.dataProvider = dataArray;
I was thinking something like this, but of course this doesn’t work---doesn't like the nameArray[i] before the dataProvider:
function setProvider():void{
var tempArray = [“temporary content”];
var nameArray:Array = [“comboBox1” ,“comboBox2”,“comboBox2”];
for (i =0, i ; nameArray.length; i++){
nameArray[i].dataProvider = tempArray;
<mx:ComboBox id="comboBox1"/>
<mx:ComboBox id="comboBox2"/>
<mx:ComboBox id="comboBox3"/>
Thanks All

Hi inanealex2010,
You can use the following approach...
function setProvider():void{
var tempArray = [“temporary content”];
var nameArray:Array = [“comboBox1” ,“comboBox2”,“comboBox2”];
for (i =0, i ; nameArray.length; i++){
//Use this line if you are placing the ComboBoxes directly in the root tag of your component
ComboBox(this.getChildByName(nameArray[i]) ).dataProvider = tempArray;
//Use this line if you are placing the ComboBoxes in any container say like canvas, Vbox or HBox
ComboBox(containerId.getChildByName(nameArray[i]) ).dataProvider = tempArray;
<mx:ComboBox id="comboBox1"/>
<mx:ComboBox id="comboBox2"/>
<mx:ComboBox id="comboBox3"/>
Thanks,
Bhasker

Similar Messages

  • Using BIND VARIABLES in REF CURSOR(s)

    Hello I am having trouble making my pl/sql program work using bind variables.
    here is a little snipit from my code:
    declare
    type ref_type is REF CURSOR;
    ref_cursor ref_type;
    summation_table varchar2(4000);
    begin
    summation_table := 'table_sum tsum';
    open ref_cursor for
    select * from :summation_table
    where tsum.revenue = 1000
    USING summation_table;
    end;
    The Error that I get is
    "bad bind variable 'summation_table'"
    could someone please help? I think the way 'tsum' is used could be a problem, but I don't know.

    SQL> CREATE TABLE TABLE_SUM(REVENUE NUMBER(10),
      2                         OTHER   NUMBER(10));
    Table created.
    SQL> INSERT INTO TABLE_SUM VALUES(1000,1);
    1 row created.
    SQL> INSERT INTO TABLE_SUM VALUES(1000,2);
    1 row created.
    SQL> variable alpha refcursor
    SQL> INSERT INTO TABLE_SUM VALUES(2000,3);
    1 row created.
    SQL> DECLARE
      2     summation_table varchar2(30) := 'table_sum tsum';
      3     PROCEDURE MYTEST(p_out out sys_refcursor)
      4     IS
      5     BEGIN
      6       OPEN p_out for 'select * from '||summation_table||
      7                      ' where tsum.revenue = :val' using 1000;
      8     END;
      9  BEGIN
    10     MYTEST(:alpha);
    11  END;
    12  /
    PL/SQL procedure successfully completed.
    SQL> print alpha
       REVENUE      OTHER
          1000          1
          1000          2
    SQL>

  • Using bind variable for ref cursors

    Hi
    I have a procedure that recieves a tablename in srcTable variable . A query is formed SELECT_Q with values from global varray.
    Table name will be dynamic and query is to be used with a ref cursor. Since table name is not known how to make the refcursor.
    tried the following.....not sure how to do it. pls help.
    PROCEDURE Process1(srcTable VARCHAR2, trgTable VARCHAR2) IS
         TYPE CURSORTYPE IS REF CURSOR RETURN :x%ROWTYPE;
         REC_CUR CURSORTYPE;
         REC_CUR_DATA :x%ROWTYPE;
         DBMS_SQL.BIND_VARIABLE(REC_CUR, ':x', SourceT);
         DBMS_SQL.BIND_VARIABLE(REC_CUR_DATA, ':x', SourceT);
         COUNTi NUMBER :=0;
         SELECT_Q VARCHAR2(1000) := 'SELECT ';
    BEGIN
    FOR COUNTi IN 1..COLUMN_NAME_ARR.COUNT-1 LOOP
              SELECT_Q := SELECT_Q || COLUMN_NAME_ARR(COUNTi) || ',';
    END LOOP;
         SELECT_Q := SELECT_Q || COLUMN_NAME_ARR(COLUMN_NAME_ARR.COUNT) || ' FROM '||SourceT;
         DBMS_OUTPUT.PUT_LINE(SELECT_Q);
    -- query to be used for making cursor.
    ---how to make the cursor
         OPEN REC_CUR FOR Select_Q;
         LOOP
         FETCH REC_CUR INTO REC_CUR_DATA;
         EXIT WHEN REC_CUR%NOTFOUND;
         END LOOP;
    END TableSnapShot_Process1;

    For online books you can start with the documentation.
    PL/SQL Packages and Types Reference
    http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/toc.htm
    PL/SQL User's Guide and Reference
    http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14261/toc.htm
    Print books
    Oracle PL/SQL Programming By Steven Feuerstein is good book to have.
    http://www.oreilly.com/catalog/oraclep4/

  • Page Specific Persistence using Session Variables

    Hi, I have read a lot about using session variables to persist the ReportDocument object across page loads.  This works fine if you have just one page open with one report.  The problem I am having is I have a web application that makes 30 or 40 different reports available to the user.  To simplify the code and make it easier to add new reports I have developed a single template aspx page that can be used to view any of the reports.
    My problem is that if the user opens 2 different reports in 2 separate tabs in the browser then the session variable persistence doesn't work because the session variable is available to both tabs.
    Is there a way to persist the ReportDocument object which is 'page' specific.
    Thanks

    Your best option is likely to have something that makes the session variable names unique.  I've done such things as putting the current datetime in the url as a querystring parameter and appending that to the variable name.  On each postback that querystring should persist.
    You might be able to use the reportclientdocument object and serialize the report and persist through view state, haven't tried this with inproc ras though.  A sample that uses the ras sdk can be found [here|http://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples]

  • Use of Ref and Persistent Objects

    Hi,
    I am using OTT and I have created a sub class for the OTT generated class
    i.e.,
    class A:public PObject//OTT generated
    class B:public A//created by me
    for Class B I need to write a static function queryKey() which will return a pointer to persistent object of class B,
    i.e.,
    B* B::queryKey(Number c,Number d);
    I have implemented it something like this...
    B* B::queryKey(      OCCI_STD_NAMESPACE::string c,
                        oracle::occi::Number d,
                        oracle::occi::Number e)
         Statement *stmt=NULL;
         ResultSet *rset=NULL;
         CCPDKey *handle=0;
         try
              string query="SELECT REF(a) FROM ";
              query=query+tableName+ (" a WHERE C=:1 AND D=:2 AND E=:3 ");
              stmt=conn-&gt;createStatement(query);
              stmt-&gt;setString(1,c);
              stmt-&gt;setNumber(2,d);
              stmt-&gt;setNumber(3,e);
              rset=stmt-&gt;executeQuery();
              if(rset-&gt;next())
                   Ref &lt; B &gt; r1(rset-&gt;getRef(1));
                   handle=r1.ptr();
         catch(...)
              stmt-&gt;closeResultSet (rset);
         conn-&gt;terminateStatement (stmt);
              throw;
         stmt-&gt;closeResultSet (rset);
    conn-&gt;terminateStatement (stmt);
         return handle;
    Is this the correct way of doing it,
    Will the persistent object pointed by handle get destroyed as the scope of Ref i.e.,r1 ends..?
    If so, what is the correct way of doing it..?
    I need this method to return a B*.
    If the way I have used is correct,Do I need to delete the variable handle once I am done using it..?I saw in "Using OCCI: Best Practices" that the persistent object should not be deleted unless you are doing rollback.
    I am new to OCCI and i am confused
    Please help
    Ajey

    In the function B::queryKey(), the Ref<B> variable will go out of scope at the end of the if {} statement and the Ref will be unpinned. So, the "handle" object pointer variable will be pointing to an object that could be freed anytime by the garbage collector.
    Can you change your design to return a Ref<B> from B::queryKey()? If you want to return the object pointer directly then you will have to manage pining/unpining of the object. With Refs, the pining/unpining is transparently managed by OCCI and with the "->" operator you can write code which is the same as with the object pointer.
    Thanks,
    Shankar

  • Opening a ref cursor using CLOB variable

    Is there any way to open a ref cusor using CLOB variable.
    When I am opening on CLOB variable , I am getting an error like 'Missing Expression'
    Please help me

    For 10g...
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_large_sql  CLOB;
      3    v_num        NUMBER := 0;
      4    v_upperbound NUMBER;
      5    v_sql        DBMS_SQL.VARCHAR2S;
      6    v_cur        INTEGER;
      7    v_ret        NUMBER;
      8  begin
      9    -- Build a very large SQL statement in the CLOB
    10    LOOP
    11      IF v_num = 0 THEN
    12        v_large_sql := 'CREATE VIEW vw_tmp AS SELECT ''The number of this row is : '||to_char(v_num,'fm0999999')||''' as col1 FROM DUAL';
    13      ELSE
    14        v_large_sql := v_large_sql || ' UNION ALL SELECT ''The number of this row is : '||to_char(v_num,'fm0999999')||''' as col1 FROM DUAL';
    15      END IF;
    16      v_num := v_num + 1;
    17      EXIT WHEN DBMS_LOB.GETLENGTH(v_large_sql) > 40000 OR v_num > 800;
    18    END LOOP;
    19    DBMS_OUTPUT.PUT_LINE('Length:'||DBMS_LOB.GETLENGTH(v_large_sql));
    20    DBMS_OUTPUT.PUT_LINE('Num:'||v_num);
    21    --
    22    -- Now split that large SQL statement into chunks of 256 characters and put in VARCHAR2S array
    23    v_upperbound := CEIL(DBMS_LOB.GETLENGTH(v_large_sql)/256);
    24    FOR i IN 1..v_upperbound
    25    LOOP
    26      v_sql(i) := DBMS_LOB.SUBSTR(v_large_sql
    27                                 ,256 -- amount
    28                                 ,((i-1)*256)+1 -- offset
    29                                 );
    30    END LOOP;
    31    --
    32    -- Now parse and execute the SQL statement
    33    v_cur := DBMS_SQL.OPEN_CURSOR;
    34    DBMS_SQL.PARSE(v_cur, v_sql, 1, v_upperbound, FALSE, DBMS_SQL.NATIVE);
    35    v_ret := DBMS_SQL.EXECUTE(v_cur);
    36    DBMS_OUTPUT.PUT_LINE('View Created');
    37* end;
    SQL> /
    Length:40015
    Num:548
    View Created
    PL/SQL procedure successfully completed.
    SQL> select count(*) from vw_tmp;
      COUNT(*)
           548
    SQL> select * from vw_tmp where rownum <= 10;
    COL1
    The number of this row is : 0000000
    The number of this row is : 0000001
    The number of this row is : 0000002
    The number of this row is : 0000003
    The number of this row is : 0000004
    The number of this row is : 0000005
    The number of this row is : 0000006
    The number of this row is : 0000007
    The number of this row is : 0000008
    The number of this row is : 0000009
    10 rows selected.
    SQL>

  • How use integer variable as object in query

    sir how use integer variable as object in query
    see my code
    Integer currentssgg = new Integer(tt.getValue().toString()); no error
    //yy.setValue(currentss); no error
    //yy.setValue(new Integer(tt.getValue().toString())); no eror
    getSessionBean1().getTripRowSet().setObject(1,currentssgg); giv error
    tripDataProvider.refresh();
    and how use string variable same as method
    please give me idea how use integer variable as object in query
    thank's
    aamir

    >> var mnu = 'menu1';
    this[mnu].onRollOver = function(){
    <<
    Close, but it needs to be like this:
    var mnu = 1;
    this["menu" + mnu].onRollOver = function(){
    Dave -
    www.offroadfire.com
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • How to use a variable as object name? in actionscript?

    I am working on a flash menu and have a problem in it.
    here is the code i am using.
    I wanna use the variable mnu instead of this[mnu] but do not
    know how to do it. Any body can help me?

    >> var mnu = 'menu1';
    this[mnu].onRollOver = function(){
    <<
    Close, but it needs to be like this:
    var mnu = 1;
    this["menu" + mnu].onRollOver = function(){
    Dave -
    www.offroadfire.com
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • How to default bind variable using session variable at run time

    Hi All,
    I have a requirement where all VO queries (multiple VOs) produce only records that meet a certain value.
    For example, I have three tables with 3 VOs and each of them has a one-to-many relationship to another table (let's call it ref table and this table has a field called release). One of the 3 VOs is a parent/master table, and the other two are child tables. I created a VO for master table that linked to the ref table and created a view criteria using the release (use bind variable) field from the ref table. The other child tables have their own VO that has view criteria that also linked to ref table using the release field.
    On the UI page, I created a query component and a table from the master table VO. I also dropped the child table VOs in a tabbed panel which partial triggered by the master table. When I ran a query for a 'release' (hint: ref table value), the table for master table was filled the correct records that meet the criteria. Unfortunately, the child tables were not correct due to the query didn't use the bind variable that filter only records for the same 'release' value as the master table.
    The question is how do I 'default' or dynamically set the bind variable on the child tables based on the selection criteria from the query component. I am thinking to set a session variable from the query and use it in the bind variable in the child table, but not sure how to do it.
    Any suggestion how to do it or better solution to achieve the same effect?

    Hi,
    How about creating a custom AMImpl method, that takes parameters as required, and set the bind variables for all the desired VOs and perform executeQuery on them.
    You could expose this as client interface, and then use the method as parameter form.
    Check this thread for ex.
    Re: Setting Attribute in View Object through Managed Bean
    -Arun

  • How to use Public variables in other classes

    Please have a look at the program.
    In the below program, i want to use the variable 'name' in the class cl_airplane1 implementation under the method aircraft to display 'BRITISH AIRWAYS' which i am passing through the object AIR1.
    The variable 'name' is declared under public section of the class cl_airplane. I do not want to use inheritance. Can i do this.
    *&             CLASS DEFINITION
    CLASS cl_airplane DEFINITION.
      PUBLIC SECTION.
        METHODS set IMPORTING  im_name TYPE string
                               im_weight TYPE i.
        METHODS display.
        DATA name TYPE string.
      PRIVATE SECTION.
        DATA weight TYPE i.
    ENDCLASS.            
    *&                   CLASS IMPLEMENTATION
    CLASS cl_airplane IMPLEMENTATION.
    *******METHOD SET*****************
      METHOD set.
        name = im_name
        weight = im_weight.
      ENDMETHOD.               
    *******METHOD DISPLAY**************
      METHOD display.
        WRITE : / ' NAME :', name, ' AND ', 'WEIGHT:', weight.
      ENDMETHOD.                   
    ENDCLASS.                   
    *&     END OF CLASS CL_AIRPLANE IMPLEMENTATION
    *&             CLASS DEFINITION-CL_AIRPLANE1
    CLASS cl_airplane1 DEFINITION .
      PUBLIC SECTION.
        METHODS : aircraft IMPORTING im_name1 TYPE string,
                  dis1.
    ENDCLASS.                   
    *&                   CLASS IMPLEMENTATION
    CLASS cl_airplane1 IMPLEMENTATION.
    *******METHOD AIRCRAFT
      METHOD aircraft.
      ENDMETHOD.                
    ********METHOD DIS1
      METHOD dis1.
      ENDMETHOD.                                         
    ENDCLASS.                 
    **********CREATING REFERENCE VARIABLES
    DATA : air TYPE REF TO cl_airplane.   
    DATA : air1 TYPE REF TO cl_airplane1. 
    START-OF-SELECTION.
    ***CREATING AN OBJECT OF THE CLASS CL_AIRPLANE
      CREATE OBJECT air .
      CALL METHOD air->set
        EXPORTING
          im_name   = 'Lufthansa'
          im_weight = '1000'.
      CALL METHOD air->display.
    ***CREATING AN OBJECT OF THE CLASS CL_AIRPLANE1
      CREATE OBJECT air1.
      CALL METHOD air1->aircraft
        EXPORTING
          im_name1 = 'BRITISH AIRWAYS'.
      CALL METHOD air1->dis1.
    <removed_by_moderator>
    Thanks.
    Edited by: Julius Bussche on Jul 30, 2008 3:13 PM

    Here is ur solution:
    *& Report  Z157780_PRG1
    REPORT  z157780_prg1.
    *& CLASS DEFINITION
    CLASS cl_airplane DEFINITION.
      PUBLIC SECTION.
        METHODS set IMPORTING im_name TYPE string
        im_weight TYPE i.
        METHODS display.
        DATA name TYPE string.
      PRIVATE SECTION.
        DATA weight TYPE i.
    ENDCLASS.                    "
    *& CLASS IMPLEMENTATION
    CLASS cl_airplane IMPLEMENTATION.
    ********METHOD SET******************
      METHOD set.
        name = im_name.
        weight = im_weight.
      ENDMETHOD.                    "set
    ********METHOD DISPLAY***************
      METHOD display.
        WRITE : / ' NAME :', name, ' AND ', 'WEIGHT:', weight.
      ENDMETHOD.                    "display
    ENDCLASS.                    "
    *& END OF CLASS CL_AIRPLANE IMPLEMENTATION
    *& CLASS DEFINITION-CL_AIRPLANE1
    CLASS cl_airplane1 DEFINITION INHERITING FROM cl_airplane.
      PUBLIC SECTION.
        METHODS : aircraft IMPORTING im_name1 TYPE string,
        dis1.
    ENDCLASS.                    "
    *& CLASS IMPLEMENTATION
    CLASS cl_airplane1 IMPLEMENTATION.
    *******METHOD AIRCRAFT
      METHOD aircraft.
        name = im_name1.
        WRITE : / ' NAME :', name.
      ENDMETHOD.                    "aircraft
    ********METHOD DIS1
      METHOD dis1.
      ENDMETHOD.                                                "dis1
    ENDCLASS.                    "
    **********CREATING REFERENCE VARIABLES
    DATA : air TYPE REF TO cl_airplane.
    DATA : air1 TYPE REF TO cl_airplane1.
    START-OF-SELECTION.
    ***CREATING AN OBJECT OF THE CLASS CL_AIRPLANE
      CREATE OBJECT air .
      CALL METHOD air->set
        EXPORTING
          im_name   = 'Lufthansa'
          im_weight = '1000'.
      CALL METHOD air->display.
    ***CREATING AN OBJECT OF THE CLASS CL_AIRPLANE1
      CREATE OBJECT air1.
      CALL METHOD air1->aircraft
        EXPORTING
          im_name1 = 'BRITISH AIRWAYS'.
      CALL METHOD air1->dis1.
    Hope That Helps
    Anirban M.

  • Using Global Variables in Data Quality Address Cleanse Transforms

    I am currently developing in Data Services 12.2.
    I am trying to dynamically populate the List Owner information in the option tabs of the USA Regulatory Address Cleanse by using global variables.  It populates the 3553 with the variable name instead of the value assigned.
    According to the Technical Manual, it is possible to use global variables in Data Quality Address Cleanse transforms:
    However, you can use substitution parameters in all places where global variables are supported, for example:
    Query transform WHERE clauses
    Mappings
    SQL transform SQL statement identifiers
    Flat-file options
    User-defined transforms
    Address cleanse transform options
    Matching thresholds
    Does anyone know if it is possible to use global variables in the option tab of the Address Cleanse; if so, can you describe how it is done?
    Thanks in advance,
    Rick

    Hi,
    U can refer to the following links in help.sap.com
    GlobalContainer Object
    http://help.sap.com/saphelp_nw04/helpdata/en/75/8e0f8f3b0c2e4ea5f8d8f9faa9461a/content.htm
    Container Object
    http://help.sap.com/saphelp_nw04/helpdata/en/78/b4ea10263c404599ec6edabf59aa6c/content.htm
    Also some of the RUN TIME CONSTANTS are available in your BPM. So if you are trying to retrieve those variables in your Mapping(that is used in BPM), also read the following thread.
    Re: Message id in BPM
    Cheers,
    Siva Maranani.

  • Using multiple variables in Dataslice

    Hello Experts,
    It appears that I can create a dataslice using variables. Here is my challenge. I have created a function to activate and de-activate the locks using a function module executed via a planning folder.
    I have two user-input variables
    plant and version.
    How can I lock individual plants per version without creating a separate dataslice for all combinations. There are many plants so I want to use the variables to decide which slice of data in the cube needs to be locked.
    or
    Can I create a dataslice via a function module like UPC_DATASLICE_INIT and
    UPC_DATASLICE_SAVE.
    Any suggestions?
    Thanks in advance
    DW

    Method IF_RSPLS_DS_METHODS~IS_PROTECTED
    DATA:
        dref  TYPE REF TO data,
        l_locked(1) TYPE c,
        l_msg TYPE edimessage,
        lv_dummy       TYPE c.
      FIELD-SYMBOLS:
        <lv_cube>          TYPE rsinfoprov,
        <lv_year>         TYPE /bic/oiyn_year,
        <ls_th_data>       TYPE ANY,
        <ls_msg>           TYPE bapiret2.
    *** create required data objects ************************************
      CREATE DATA dref LIKE LINE OF c_th_data.
      ASSIGN dref->* TO <ls_th_data>.
    *** assign values ***************************************************
      ASSIGN COMPONENT:
        '0INFOPROV' OF STRUCTURE <ls_th_data> TO <lv_cube>,
        'YN_YEAR'  OF STRUCTURE <ls_th_data> TO <lv_year>.
      LOOP AT c_th_data INTO <ls_th_data>.
    *   Do not warn for entries from other cubes
        CHECK <lv_cube> EQ 'MY_PLANNING_CUBE'.
        CLEAR : l_locked, l_msg.
        IF <lv_year> EQ '2006'.
           MOVE 'X' TO l_locked.
           EXIT. " from LOOP
        ENDIF.
      ENDLOOP.
      MOVE l_locked TO e_noinput.
    ENDMETHOD.

  • Using a variable in a view?

    I know that it may not be possible to use a variable within a view, but I'm wondering if there isn't a work-around? If there is a single value---pulled from another table---you wish to reuse in a view that does not use dynamic SQL, how do you do so? I've been toying around with WITH statements, but that's getting me nowhere. I'm using 11r2.
    BTW, please do not ask me the standard litany of angry-dba questions (why are you doing this? your database is f*****, RTFM, etc.), this is just for my own curiosity. :)
    Thank you
    Example for demo purposes only (I know it's not syntactically correct):
    variable var_value varchar2(30)
    begin
    select this_is_just_one_value
    int :var_value
    from tableX where column1 = 'BOB';
    end;
    select
    numerous_columns
    from tableY
    where
    column5 = :var_value;

    893968 wrote:
    BTW, please do not ask me the standard litany of angry-dba questions (why are you doing this? your database is f*****, RTFM, etc.), this is just for my own curiosity. :)Why are you doing this? your database is f*****! RTFM! Etc!! ;-)
    SQL is not a procedural language - so you cannot create a view for example that has a parameter signature. E.g. this is possible in a procedural language:
    declare
            cursor c( deptID number ) is
                    select * from emp where deptno = deptID;
    begin
            open c( 1234 ); --// open SQL cursor using a parameter/variable
            --// etc..
            close c;
    end;This is not possible using a SQL object like a view. As a view is not a procedure. So the same approach as the above using SQL (silly example, but do demonstrates the basics):
    // define
    create or replace view emp_view as select * from emp;
    // use
    select * from emp_view where deptno = 1234;The CBO is clever - and it will likely push such a predicate into the emp_view SQL statement.
    To parameterise such a view, is ugly. And should only be considered when dealing with issues such as security and data restrictions. A context is created - this can contain a number of name-values. The view can then use a name-value from the context. Oracle's data dictionary views use this approach.

  • How to use a variable between interfaces or class?

    Hello All;
    Far by now I can say that the forum is very helpful for me. Thanks for all the people who have the time and generosity to help our problems. Thank you.
    Unfortunately I have a problem <Again :( >
    I want to use a variable in two different *.java files.
    Is it possible?
    The Variable i want to use is; int CiftSayisi
    The variable is declared in the CamCalib.Java under a button's Action Listener.
    Here is the code;
    public void actionPerformed(ActionEvent arg0) {
                        ImagePair.main(null);
                        String[] ImPath = list.getItems();                                           //Storing Items in an Array
                        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();                     //Dimensions of the Screen Storing in an object
                        int ScreenHeight = dim.height;                                           //Definition ScreenHeight
                        int ScreenWidth = dim.width;                                          //Definition ScreenWidth
                        // System.out.println(ScreenHeight);                                                    //Testing of the Dimensions
                        // System.out.println(ScreenWidth);                                                     //Testing of the Dimensions
                        int CiftSayisi = ImPath.length -1 ;
                        if (CiftSayisi == 0){
                             System.out.println("Added Images do not Construct a Pair");
                        else {
    }Now i want to use it in another java file which is ImagePair.Java in the loading part of the interface;
                 setType(Type.UTILITY);
              setTitle("Image Pair Selection");
              setResizable(false);
              setAlwaysOnTop(true);
              setBounds(100, 100, 450, 68);
              contentPane = new JPanel();
              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
              setContentPane(contentPane);
              contentPane.setLayout(null);
              textField = new JTextField();
              textField.setBounds(61, 11, 22, 20);
              textField.setEditable(false);
              textField.setEnabled(false);
              contentPane.add(textField);
              textField.setColumns(2);I have a text field in here that i need to fill with the value of CiftSayisi
    Any help please?
    ömer kaya
    METU-GGIT
    Edited by: Ömer K. on Apr 10, 2012 12:43 AM

    I didn't bother reading the code, since you didn't format it.
    But to answer your question (if I understand it correctly), yes, it is possible to pass variables between different object instances (not from an interface specifically, since interfaces don't have members). The simplest way to pass the variable as an argument to a method or constructor. If these aren't available, you could create a static global variable, though in a multithreaded app you'd have to synchronize access.

  • Query don't use the right index when using bind variables

    Hi people !
    I need some help because I have an issue with a query that don t use the right Indexes as it should
    First of all, I have mainly three tables :
    ORDER : Table that contains description for each Order (approximately 1 000 000 Records)
    ORDER_MVTS : Table that contains the tasks made (called movements) to set up each Orders
    with quantity of packages prepared for each product (approximately 10 000 000 Records)
    PRODUCT : Tables that contains the products (approximately 50 000 Records)
    When I launch the query with hard coded values, it brings back response very fast
    because it uses the right index (ORDER_DHR_VALID) which represent the date and hour of the order
    (with format 'DD/MM/YYYY HH24:MI:SS'). The selectivity for this index is good.
    NB 1: I have to use the trick " >= Trunc(date) and < trunc(date) +1 " to filter on a simple date because
    the index contains hour and minutes (I know it wasn't probably a bright idea at conception time).
    NB 2: The index on ORDER_MVTS.PRODUCT_CODE is'nt discriminating enough because there is'nt enough different products.
    It's the same for index on CUSTOMER_CODE and on MVT_TYPE so only the index on ORDER.DHR_VALID is good.
    Here is the correct explain plan when I execute the query with hard coded values :
    SELECT SUM(ORDER_MVTS.NB_PACKAGE)
    FROM ORDER_MVTS, PRODUCT, ORDER
    WHERE ORDER.DHR_VALID >= TRUNC(to_date('14/11/2008 10:04:56','DD/MM/YYYY HH24:MI:SS'))
    AND ORDER.DHR_VALID < TRUNC(to_date('14/11/2008 10:04:56','DD/MM/YYYY HH24:MI:SS')) + 1
    AND ORDER_MVTS.MVT_TYPE = 'DELIVERY'
    AND PRODUCT.CODE = ORDER_MVTS.PRODUCT_CODE
    AND ORDER_MVTS.ORDER_CODE = ORDER.CODE
    AND ORDER.CUSTOMER_CODE = 'ADIDAS'
    AND PRODUCT.CODE = 1234
    Rows Row Source Operation
    1 SORT AGGREGATE
    2 NESTED LOOPS
    4 NESTED LOOPS
    2 INDEX UNIQUE SCAN (object id 378548) --> PRODUCT_PK
    4 TABLE ACCESS BY INDEX ROWID ORDER
    777 INDEX RANGE SCAN (object id 378119) --> ORDER_DHR_VALID
    2 TABLE ACCESS BY INDEX ROWID ORDER_MVTS
    30 INDEX RANGE SCAN (object id 377784) --> ORDER_MVTS_ORDER_FK
    Now the problem is when the query is used in a Cursor with bind variables.
    It seems like Oracle don't use index on ORDER.DHR_VALID because he can't figure out that he have
    to actually filter on a short period of time (only one day).
    So Oracle uses the index on ORDER_MVTS.PRODUCT_CODE which is'nt a bright idea (it takes 10 secondes instead of just one)
    Here is the bad explain plan :
    Rows Row Source Operation
    1 SORT AGGREGATE
    2 NESTED LOOPS
    722 NESTED LOOPS
    2 INDEX UNIQUE SCAN (object id 378548) --> PRODUCT_PK
    722 TABLE ACCESS BY INDEX ROWID ORDER_MVTS
    1790 INDEX RANGE SCAN (object id 377777) --> ORDER_MVTS_PRODUCT_FK
    2 TABLE ACCESS BY INDEX ROWID ORDER
    1442 INDEX UNIQUE SCAN (object id 378439) --> ORDER_PK
    Now I have found two solutions to this problem :
    1) using a Hint to force the use of index on ORDER.DHR_VALID (with /*+ INDEX(ORDER ORDER_DHR_VALID) */ )
    2) Using Dynamic SQL and keeping the date hard coded (but not the other values except mvt_type)
    For example :
    QUERY :=
    'SELECT SUM(ORDER_MVTS.NB_PACKAGE)
    FROM ORDER_MVTS, PRODUCT, ORDER
    WHERE ORDER.DHR_VALID >= TRUNC(TO_DATE('''||To_char(P_DTE_VAL,'DD/MM/YYYY')||''',''DD/MM/YYYY'')) '||
    AND ORDER.DHR_VALID < TRUNC(TO_DATE('''||To_char(P_DTE_VAL,'DD/MM/YYYY')||''',''DD/MM/YYYY'')) + 1 '||
    AND ORDER_MVTS.MVT_TYPE = 'DELIVERY'
    AND PRODUCT.CODE = ORDER_MVTS.PRODUCT_CODE
    AND ORDER_MVTS.ORDER_CODE = ORDER.CODE
    AND ORDER.CUSTOMER_CODE = :CUSTOMER
    AND PRODUCT.CODE = :CODE ';
    These two solutions work but Number 1 is bad in theory because it uses a Hint
    and Number 2 may be difficult to code.
    So my question is : Does someone knows another solution to force the use of index ORDER_DHR_VALID that can be simple and reliable.
    Thank you very much for support
    Edited by: remaï on Apr 1, 2009 4:08 PM

    What version of oracle you have? CBO work is different in 9i and 10g.
    Usually cost based optimizer do not want to use index for >< condition with binding variables because optimizer can not use statistic to determine selectivity, and by default selectivity of <> operators is low.
    (As I remember '>' selectivity by default is 5%, you have two conditions > and <, therefore resulting selectivity will be 0.05*0.05=0.0025 as two independent events, but selectivity of other conditions
    ORDER_MVTS.MVT_TYPE = 'DELIVERY' or ORDER.CUSTOMER_CODE = 'ADIDAS' looks much better for CBO)
    The best solution I see is do not use binding variables. Actually your query looks as searching query, which executes not so often, therefore you will not have perfomance win along of skipping execution plan creation.
    Edited by: JustasVred on Apr 1, 2009 10:10 AM

Maybe you are looking for

  • Image quality reduced when scaled down on black background

    I am trying to view two tracks at the same time so I have scaled them down. Once I rendered them, the quality was horrible and then I changed the background to checkerboard instead of black, which worked, but I would like a black background for viewi

  • Will Aperture print different size photos on 1 sheet?

    In Aperture, is it possible to print multiple photos per sheet, with different sizes for each photo? Each photo may be unique, or I may want to use the same photo for each size. In the past I have used Qimage on the PC, and would like to know if Aper

  • Can't add new contacts in Mavericks

    Since installing Mavericks I can't add anything to Contacts. It behaves as if it's working right up until I close it, whereupon it promptly deletes all the information I just added. It also won't let me delete existing contacts. The only account I ha

  • Where Do My Applications Live?

    Hello I was wondering and this may be a stupid question so please forgive my ignorance.In my sidebar I having showing in this order: Applications. Desktop. Documents. Downloads. Music. And my home folder named Jaco. Devices I have the Mac HD showing

  • Fixed Assets - CBFResourceLoader::GetChildNode      dbdatasources node not fou

    Hello, The result of my depreciation run in SBO is this : No Postings and in the log i can find out here : C:DOCUME1ADMINI1LOCALS~1Temp1SAP Business One Log The message is this : CBFResourceLoader::GetChildNode      node not found. Any idea ? Thanks