0 Replies Latest reply on Oct 17, 2009 4:24 AM by erthy

    How to use a variable inside a variable?

    erthy

      Hey, I am trying to ask for a part of an XML file, and I want to change the variables I use to do that. In short words, why is my code not working?:

      var slid = 3;

                     var lang = "en";

                     var slovicko = slovnikXML.slovicko.(@id == [slid]).@[lang];

                     Alert.show("Slovíčko je: " + slovicko);

      even though this:

      var slid = 3;

                     var lang = "en";

                     var slovicko = slovnikXML.slovicko.(@id == 3).@en;

                     Alert.show("Slovíčko je: " + slovicko);

      is working perfectly --> not a problem in the slovnikXML variable.

      this also works:

      var slid = 3;

                     var lang = "en";

                     var slovicko = slovnikXML.slovicko.(@id == 3).@[lang];

                     Alert.show("Slovíčko je: " + slovicko);

      So the probelm is somewhere around the @id part...

      Any suggestions?

      Thanks!