Skip navigation
Currently Being Moderated

Loop through a model to get variables and values

Aug 1, 2012 11:29 AM

Tags: #data #actionscript

I use an AS model (named AppGlobals.as) to store the application variables. I need to replace the hard-coded values of the elements to ones pulled from a database. As such, I need to iterate through the model to find all the elements that match my query results and then set the value of the elements to those returned from the database query.

 

My current issue is that I have no clue how to iterate through the model to get the elements so that I can use them a parameters for my query. An example of AppGlobals.as follows...

 

package com.models

{

          [Bindable]

          public class AppGlobal

          {

                    public var appAnnualMaintenanceAlert:String="The System is unavailable due to routine annual maintenance!  Please check back after 2:00 PM Eastern on  January 1, 2012!";

                    public var appAnnualMaintenanceStart:Date=new Date(2012, 11, 31, 18, 0, 0, 0);

                    public var appAnnualMaintenanceEnd:Date=new Date(2013, 0, 1, 14, 0, 0, 0);

                    public var appYearPrevious:String="2011";

                    public var appYear:String="2012";

                    public var appYearNext:String="2013";

                    public var dttm_landing_expected:String="1/1/2012 12:00:00 AM";

 

 

          }

}

 

How can I iterate through the model to find all the var names and then match them with my query to return the corresponding values?  Any help is appreciated.

 

Thanks!

Lee

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points