Variable that references an object

In general, I am trying to use a variable to refer to an object.  On the Flex 3 platform, I have about 100 radio button groups.  I want to loop through data that has been returned from the database and turn the radio buttons on or off based on the data.
public function ....
var counter:Number = 1;
var aString:String = "";
var qString:String = "";
loop......
sString = ("A"+counter);
qString = ("q"+counter);
if (returnArray[0].aString == "0"){
qString.selectedValue = "agree";
counter++;
My radiobutton objects are named q1, q2, q3, etc.  The string qString.selectedValue = "agree"; is not evaluating as an object name.  I have tried .valueOf() and still generate errors.  I know I am trying to do something stupid.  Can someone please enlighten me?

I have now run into another related syntax issue.  When I try to use the same syntax in a reference to an arrayCollection I am failing. see code:
allData is an arrayCollection, that in index[0] has values for A1, A2, A3, etc.
public function handleQAResults():void {
var counter:Number = 1;
var aVal:String = "";
var qVal:String = "";
  while(counter <5) {
     aVal = ("A"+counter);
     qVal = ("q"+counter);
     if (allData[0].this[aVal] == "0") {
          this[qVal].selectedValue = "absolutely disagree";
     counter++;
If I hardcode (allData[0].A1 == "0") the code works, but I want to loop through A2, A3, etc.
I have also tried (allData[0].aVal == "0")
(allData[0].aVal.valueOf() == "0")
and a great combination of double quotes, single quotes, parentheses, and so on.
The code inside the IF statement works.  The IF statement itself doesn't.

Similar Messages

  • Grant a user the select permission on a view that references external objects

    Hi all,
    SQL Server 2012 Enterprise Edition SP2.
    I've a database (let's say SRC_DB) that contains a series of views, some of these views refercenses tables or other views in other databases (let's say EXT_DB). I'm searching the best way to grant a user permission to SELECT from that view without granting
    permission to every single obejct in external databases referenced by the view.

    There is a dmv that tells you all the referenced views and tables. you can use that to get the list of all the tables,views being referenced in the cross database and them scrip the to grant only on those views\tables.
    the link  is here:  https://msdn.microsoft.com/en-us/library/bb677315.aspx
    example from the link that woulf work for your suitation:
    CREATE DATABASE db1;
    GO
    USE db1;
    GO
    CREATE PROCEDURE p1 AS SELECT * FROM db2.s1.t1;
    GO
    CREATE PROCEDURE p2 AS
    UPDATE db3..t3
    SET c1 = c1 + 1;
    GO
    SELECT OBJECT_NAME (referencing_id),referenced_database_name,
    referenced_schema_name, referenced_entity_name
    FROM sys.sql_expression_dependencies
    WHERE referenced_database_name IS NOT NULL;
    GO
    USE master;
    GO
    DROP DATABASE db1;
    GO
    Hope it Helps!!

  • How Do I Convert a String that Names an Object to a Reference to the Object

    You get many program-specific object names in the XML that is returned by describeType.  Suppose I find an object that interests me.  What is the best way to convert the String that names the object (e.g. the id of the object) to a reference variable that points to the object? 

    Sure.  I am working on a complex application that involves several ViewStacks, several Accordions, some checkboxes, some radio buttons, some text boxes.  These components are scattered about, but all are children of a base class that is successfully enumerated by
    var classInfo:XML = describeType(vwstk);
    Suppose I write a loop as follows:
     for each (var a:XML in classInfo..accessor){
    Inside that loop I have a series of tests like
    if (a.@type == "mx.controls::CheckBox"{
    Then, I iterate thru all of the children of the base class as in:
    for  
    (var u:Object in vwstk)
    {        if  
    Inside the if I persist the checked/not checked status of the checkbox.
    The tricky part is going from the string a.@name to the Object reference u.  I doubt my proposed method will work.  Do you have a better idea?

  • References to objects and variables and their values.

    When does declaring a primitive type, variable or object as another objectm primitive type, or variable assign the variable THAT VALUE, and when does it just make it another reference to that object. And when it DOES just refer to that object, how do I set it to the value instead of just a reference?
    I can elaborate if necessary. I hope I was clear enough

    KeganO wrote:
    Yes, that's very clear. So all I want to know now is, if I had in my code something like
    Point a = new Point(1, 1);
    then say 50 lines later, I want to create a new point object, with the same VALUE as a but does not refer to the same object. How would I do that?That depends on the class. Look at Point's docs. If it implements Cloneable, you can call clone(). If it has a constructor that takes a reference to a point as an argument (copy constructor), you can use that. Otherwise you'll have to extract the two values and call new Point(oldPointX, oldPointY).
    Some classes you might not be able to do it at all.
    There's no guaranteed way to do it provided by the language though. It all depends on whether the class is implemented to provide it.
    >
    Also, what are the code tags?When you put code into a forum message, in order to preserve formatting, you put it between [code] and [/code].
    [code]
    for (int i = 0; i < 10; i++) {
    if (something) {
    doStuff(i);
    [/code]
    becomes
    for (int i = 0; i < 10; i++) {
      if (something) {
        doStuff(i);
    }

  • Error: demo.model.AppModule: Application module demo.model.AppModule has a view instance EmpByEmail1 that references an invalid view object.

    Error: demo.model.AppModule: Application module demo.model.AppModule has a view instance EmpByEmail1 that references an invalid view object.
      intially i created view object named EmpByEmail.........for that EmpByEmail1 is created in datacontrols....i deleted EmpByEmail in demo.model by mistake and i created again with same name EmpBYEmail another view object...again another EmpByEmail2 is created in datacontrols.....
    while i am running i am getting following error:::::::
    Error: demo.model.AppModule: Application module demo.model.AppModule has a view instance EmpByEmail1 that references an invalid view object.

    Hi,
        Please seasrch for the EmpByEmail1 file in ur project and remove all the details in the Page Def and UI and then try again.
    Due to the EmpByEmail1 existance in page Def this may occur . It may help , still if it was not working then I am sorry for that.

  • After December 2014 update, Compile Error - calling Excel Objects Sub "Object library invalid or contains references to object definitions that could not be found"

    When try to call Sub in Excel Objects > SheetXX after the original xlsm is modified and saved by another user in diff machine, getting an error below and seems Excel cannot identify any subs exists in Sheet.
    Compile error:
    Object library invalid or contains references to object definitions that could not be found
    Note: it seems that this problem has been occurring After December 2014 update and still exists even after applying the fix:
    http://blogs.technet.com/b/the_microsoft_excel_support_team_blog/archive/2014/12/11/forms-controls-stop-working-after-december-2014-updates-.aspx)

    Hi Kwlee324,
    Thanks for sharing the workaround with us. It would be very helpful for others who have the same issue.
    Also I found a two useful links about the error message "Object library invalid or contains references to object definitions that could not be found":
    https://support.microsoft.com/kb/2703186
    http://blogs.msdn.com/b/vsod/archive/2009/06/05/visual-basic-6-controls-stop-working-after-security-advisory-960715.aspx
    Hope it is helpful.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Compile error: Object library invalid or contains references to object definitions that could not be found

    Office Online 365 installed today January 20 on brand new HP Envy. Get the above message when loading Excel applications with code and when running code. Will greatly appreciate help. Applications run well on other computers.

    Hi Jaime,
    >> Get the above message when loading Excel applications with code and when running code. Will greatly appreciate help. Applications run well on other computers.
    >> Compile error: Object library invalid or contains references to object definitions that could not be found
    According to the error message, it seems some ActiveX control is not registered successfully on the new machine.
    Would you mind telling us which ActiveX controls you used in the workbook?
    >> For my applications Excel from Office 365 is now useless. Should I just let my subscription run out and purchase another version?
    According to my experience, this issue is not related to the subscription.
    Regards,
    Jeffrey
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Object library invalid or contains references to object definitions that could not be found problem

    Hello,
    Yesterday I got the following error on the server: "object library invalid or contains references to object definitions that could not be found problem".
    I found this documentation, followed the steps and all was OK on the server:
    http://support.microsoft.com/kb/2703186/en-us
    https://social.msdn.microsoft.com/Forums/office/en-US/e94f2fc3-71f1-4dad-bbf1-37f906e28e8e/object-library-invalid-or-contains-references-to-object-definitions-that-could-not-be-found?forum=exceldev
    Our server is used to do batch processing for refreshing our excel's. This morning, after the excel's got refreshed on the server, I've got this error on the
    client computers (everything works fine on the server computer). I did the steps above on the client computers, but the problem still persists.
    It looks like there is a difference in version between server and client.
    If I do the refreshing on the same computer there is no problem. But when the server does the refreshing and I try to open it on a different computer, I get this error.
    The security update has been removed from the computer, but I can't use my excel's anymore.
    Does any one have some advice for me?
    Best regards,
    Wouter

    Hi Wouter,
    Thanks for the further explaintation.
    According to the description, the issue seems that the Workboook on the client side(with lower Excel version) couldn't run the VBA after it opened by server(higher version Excel application).
    If I understood correctly, that sounds that the issue is relative to the specific version of Excel product or the updates.
    I suggest you contacting Microsoft support to raise an incident so that our engineer could work closely with him to identify the root cause and resolve this issue as soon as possible.
    If the support engineer determines that the issue is the result of a bug the service request will be a no-charge case and you won't be charged.
    Please visit the below link to see the various paid support options that are available to better meet your needs.
    http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Object library invalid or contains references to object definitions that could not be found

    I have an excel macro application. It works ok in my machine. Whenever I send it to my colleague and he opens the file and save and send it back to me, I get the below error. But, it is working
    ok in my colleague machine.
    Compile error:
    Object library invalid or contains references to object definitions that could not be found
    Looks like some recent windows update is causing this issue. I tried to delete the temporary file from the command prompt as mentioned in some of the forums using the below command. But, still it
    is not working.
    DEL /S /A:H /A:-H *.EXD
    Even tried to uninstall the recent windows update on both of our machines, but still the issue is not resolved. It is working ok in his machine, but I get the compile error. Please share your thoughts.
    Thanks.
    Below are the references available in the excel macro application. There is no missing reference error on both of our machines. We both are using Excel 2010 32 bit. My OS is windows 7 64 bit and
    my college is having windows 7 32 bit.
    Visual Basic For Applications
    Microsoft Excel 14.0 Object Library
    Microsoft Forms 2.0 Object Library
    Microsoft Office 14.0 Object Library
    OLE Automation
    Microsoft ActiveX Data Objects 2.6 Library
    Microsoft Visual Basic for Applications Extensibility 5.3
    Microsoft XML, v6.0

    "Looks like some recent windows update is causing this issue. I tried to delete the temporary file from the command prompt as mentioned in some of the forums
    using the below command"
    I've heard some cases that even deleting EXD files and running the FixIt tools, ActiveX controls weren't working.
    Can you confirm if you can insert ActiveX controls in your worksheet, please?
    (Developer tab >> Insert button >> any ActiveX control of your choice)
    Felipe Costa Gualberto - http://www.ambienteoffice.com.br

  • Convert String variable value  to an Object referece type

    Hi all,
    I want to know that if there any possible way to convert String variable value to a Object reference type in java. I'll explain by example if this is not clear.
    Let's think that there is a string variable name like,
    String name="HelloWorld";
    and there is a class name same to the variable value.
    class HelloWorld
    I am passing this string variable value to a method which is going to make a object of helloworld;
    new convertobj().convert("HelloWorld");
    class convertobj{
    public void convert(String name){
    // in hert it is going to create the object of HelloWorld;
    // HelloWorld hello=new HelloWorld(); just like this.
    now i want to do this from the name variable value.( name na=new name()) like wise.
    please let me know if there any possible way to do that.
    I am just passing the name of class by string variable then i wanted to make a instance of the class which come through the variable value.
    thanx.

    Either cast the object to a HelloWorld or use the reflection API (Google it) - with the reflection API you can discover what methods are available.
    Note: if you are planning to pass in various string arguments and instantiate a class which you expect to have a certain method... you should define an interface and have all of your classes that you will call in this way implement the interface (that way you're sure the class has a method of that name). You can then just cast the object to the interface type and call the method.
    John

  • Dynamic Variable Naming for Sound Object

    Is it possible to dynamically name a variable? I'd like to
    create a new Sound Object on the fly, so that I can use the
    Sound.load() method multiple times. I would simply like to create
    and name the variable and add a number to the end of the name
    (i.e.; var "audio_1":Sound). I'm sure that this is possible.
    However, I can't seem to get it figured out.

    This code worked great! However, how can I set a global
    variable equal to the newly created Sound Object so that it is
    available globally via a reuseable reference?
    Here's an example of how I attempted to do this. Please note:
    audioObject is a global variable that I am trying to use to
    reference the new Sound Object in various places.
    audioObjectCount is a global variable that I am using to set
    or get the next number to use when dynamically creating the next
    new Sound Object

  • Is it possible in java to pass reference of object in Java?

    Hello,
    I'm relativily new to Java but I have "solid" knowledge in C+ and C# .NET+.
    Is it possible in java to pass reference of object in Java? I read some articles about weakreferences, softreferences, etc. but it seems that it's not what I'm looking for.
    Here is a little piece of code I wrote:
    package Software;
    import java.util.Random;
    * @author Rodrigue
    public class RandomText
        private Random rand = new Random();
        private Thread t;
        private String rText = "Rodrigue";
        public RandomText()
            t = new Thread()
                @Override
                public void run()
                    try
                        while(true)
                            UpdateText();
                            sleep(100);
                    catch(InterruptedException ex)
            t.start();
        private void UpdateText()
            int i = rand.nextInt();
            synchronized (rText)
                rText = String.valueOf(i);
        public String GetText()
            return rText;
    }It's just a class which start a thread. This class updates a text with a random integer 10 times per second.
    I would like to get a reference on the String rText (like in C++ ;) yes I know, I must think in Java :D). So, like that, I could get one time the reference, thanks to the GetText function, and update the text when my application will repaint. Otherwise, I always have to call the GetText method ... which is slow, no?
    Are objects passed by reference in java? Or, my string is duplicated each time?
    Thank you very much in advance!
    Rodrigue

    disturbedRod wrote:
    Ok, "Everything in Java is passed by value. Objects, however, are never passed at all.". Reference of object is passed by value too.
    But, how to solve my problem in Java_? I have an object which is continually modified in a thread. From an another side, this object is continually repainted in a form.I'm not sure I totally understand your problem. If you pass a reference to an object, then both the caller and the method point to the same object. Changing the internal state of the object (e.g. by calling a setter method) through one reference will be observed through both references, since they both point to the same object.
    No, calling a method is not particularly slow. Especially if it's just a simple getter method that returns the value of a member variable.
    If this is happening in a multithreaded context, you'll have to use proper synchronization to ensure that each thread sees the others' changes.

  • Newbie needs help with passing variables or creating flash object based on parameters

    Hello Community,
    I'm an amateur developer of Ms Access databases. In one of my applications I want to visualize the options available when reaching a certain score.
    What I'd like to get from this trial period, is a flash animation of a dartboard. Depending on an array of variables that provides the fill color (or reference thereof) the layers of the flash object will be dynamicly created, altered, or switched. The dartboard itself remains "static". I'm hoping to use 9 colors.
    I can manipulate the array any way needed. I can provide XML coding to pass the array variables. I'm just too new and untrained to incorporate this in a Edge animation or Dreamweaver.
    There is no need for interaction, once the object is created (ie no user feedback).
    Can someone point me in the right direction?
    thanks in advance,
    Jay from Stockholm

    Hi,
    I see you're using System.Data.OracleClient (which has been deprecated by MS) rather than Oracle.DataAccess.Client, but this works for me with Oracle's ODP, maybe it will help.
    Cheers,
    Greg
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    using Oracle.DataAccess.Types;
    public class dataadapterfill
        public static void Main()
            using(OracleConnection con = new OracleConnection("user id=scott;password=tiger;data source=orcl"))
                con.Open();
                using(OracleCommand cmd = new OracleCommand("select ename from emp where ename = :1", con))
                    cmd.Parameters.Add(new OracleParameter("myename", OracleDbType.Varchar2, 50)).Value = "KING";
                    OracleDataAdapter da = new OracleDataAdapter(cmd);
                    DataSet ds = new DataSet();
                    da.Fill(ds);
                    foreach (DataRow row in ds.Tables[0].Rows)
                        Console.WriteLine("ename: {0}", row["ename"]);
    }

  • Pointers or reference to objects

    I have a basic question... If I have a Collection of type Vector and I want to loop thru each contained object and modify it, how can I do that? I want to be able to modify it in place rather than reading it out and then replacing it back in...
    Moreover, how does java handle this kind of situation, I nkow it doesn't support pointers but you can get it to pass references to some object (accomplishing the same thing) but I am not clear on this...

    Never mind about the v1.elementAt(index) = ... That
    code isn't even valid
    But I am still confused on the reference passing in
    Java :(For a lot of your "what-if" questions, you'd probably be better served by writing a few flavors of test code and trying it yourself.
    The following links might help with understanding references.
    http://www.javaworld.com/javaworld/javaqa/2000-05/03-qa-0526-pass.html
    http://javadude.com/articles/passbyvalue.htm
    http://www-106.ibm.com/developerworks/java/library/j-passbyval/
    http://www.google.com/search?hl=en&lr=&ie=UTF-8&safe=off&q=java+pass+by+reference&btnG=Search
    One simple rule to keep in mind--every variable that you think of as an "object" is in fact a reference. The variable holds the address of an object. It works just like pointers in C/C++, except that you can't treat it as an int or long and do math with it, and you can't assign an arbitrary number to it.
    &para;

  • Cross Reference an Object??

    How do I cross reference an object using Indesign CS4?
    I've got a PDF that I've dropped into a frame, which I applied an Object Style.  Now I need to create a cross references in the document, that point to the PDF (a chart).  I've got to do this with several PDF's.
    When I go to create a cross reference, I can only apply it a Paragraph Style or a Text Anchor, I don't get an Object Style to choose from.
    I could put some text in behind the chart, and arrage the chart to the front, but i'd rather create a cross reference to the Object itself.
    What do i do?

    sammy003 wrote:
    How do I cross reference an object using Indesign CS4?
    I've got a PDF that I've dropped into a frame, which I applied an Object Style.  Now I need to create a cross references in the document, that point to the PDF (a chart).  I've got to do this with several PDF's.
    When I go to create a cross reference, I can only apply it a Paragraph Style or a Text Anchor, I don't get an Object Style to choose from.
    I could put some text in behind the chart, and arrage the chart to the front, but i'd rather create a cross reference to the Object itself.
    What do i do?
    Cross-references only point to text - either a text anchor or a paragraph - not to objects.
    If your placed PDF is in an anchored frame, you can point the cross-reference to the paragraph in which the frame is anchored.
    If your placed PDF is not in an anchored frame, you can do what you suggest above, or you have these other options:
    * place the PDF into a text frame
    * create a text frame and group it with the PDF; point the cross-reference to the paragraph in the text frame, or insert a text anchor in the text and point the cross-reference to it.
    * you can paste the grouped PDF and text frame object into a text frame to make it an anchored frame.
    The idea of a cross-reference is usually to point to a caption or heading. You can't point to the text in a placed PDF because it's really a graphic. You'll probably want a caption to identify the chart. The caption is the text you cross-reference to. The caption can be in the paragraph that holds the anchor, in a text frame grouped with the graphic, in a paragraph above or below the graphic, or in an anchored frame that's positioned near the graphic.
    If your layout will not reflow, you probably don't need an anchored frame, but if the layout will reflow, you'll want to use the ability of an anchored to move with the text.
    Read about cross-references and anchored frames in Help. If your caption will be numbered, such as "Figure 3," also read about numbered lists and numbering properties of paragraph styles.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

Maybe you are looking for