What is the better solution?

Hello,
I am pretty new to Flex / Flash Builder and am getting stuck with the following
I have a database with say 2 tables: One with the list of items available and one table with the list chosen for specific projects
The design view I intend to use are 2 datagrids side by side and a couple of buttons to add/delete an item from the projects.
I also have a combobox to select the project for which I want to add/delete items. This combo box will filter all records with the chosen project name.
The code I did based on local data (not server connection) is attached below.
So far so good.
Now, I want to replace the local data hold in ArrayCollections with data from a MySQL database.
There my problem starts. In all tutorials about Flashbuilder, the databases are shwoing data directly in datagrids while I want to do this detour going thru local arraycollections (for instances to filetr data for the selected project or to render data differently)
I am stuck.
Can somebody give me the precious hint to progress further
BR
Peter Hirt
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
   xmlns:s="library://ns.adobe.com/flex/spark"
   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
import spark.events.IndexChangeEvent;
[Bindable]
public var projects:ArrayCollection = new ArrayCollection([
{label:"Spear2340", data:1},
{label:"Lille", data:2},
{label:"AP9600", data:3},
{label:"Arnie", data:4},
{label:"Neuron", data:5},
{label:"Cannes", data:6} ]);
[Bindable]
private var usedIP:ArrayCollection = new ArrayCollection([
{project:"Spear2340", IP:"USB2 PHY", cost:"180000"},
{project:"Lille", IP:"DDR PHY", cost:"180000"},
{project:"AP9600", IP:"DDR PHY", cost:"180000"},
{project:"Arnie", IP:"Ethernet Controller", cost:"180000"},
{project:"Arnie", IP: "USB2 Host Controller", cost:"180000"},
{project:"Neuron", IP:"USB2 PHY", cost:"180000"},
{project:"Neuron", IP:"USB2 Host Controller", cost:"180000"},
{project:"Cannes", IP:"USB3 PHY", cost:"180000"} ]);
[Bindable]
private var selectedName:String = "Arnie";
[Bindable]
private var ipCatalog:ArrayCollection = new ArrayCollection([
{IP:"USB2 PHY", technology:"40lp", cost:"180000"},
{IP:"USB2 Host Controller", technology:"na", cost:"64000"},
{IP:"USB3 PHY", technology:"40lp", cost:"270000"},
{IP:"Ethernet Controller", technology:"na", cost:"38000"},
{IP:"SATA Host Controller", technology:"40lp", cost:"60000"},
public function handleProjectSelected(event:IndexChangeEvent):void
selectedName = DropDownListProjects.selectedItem.label;
// filter against the project name
usedIP.filterFunction = filterProject;
usedIP.refresh();
sumUpColumn();
totalProjectPrice.visible = true;
private function filterProject(item:Object):Boolean
return item["project"].match(new RegExp(selectedName, 'i'))
protected function addBtn_clickHandler(event:MouseEvent):void
usedIP.addItem(ipCatalogDG.selectedItem);
var currentlySelectedItem : Object = ipCatalogDG.selectedItem;
currentlySelectedItem.project =  DropDownListProjects.selectedItem.label;
usedIP.itemUpdated(currentlySelectedItem);
usedIP.refresh();
sumUpColumn();
protected function deleteBtn_clickHandler(event:MouseEvent):void
usedIP.removeItemAt(usedIPDG.selectedIndex);
sumUpColumn();
protected function usedIPDG_clickHandler(event:MouseEvent):void
if (usedIPDG.selectedIndex !=-1) {
deleteBtn.enabled = true;
addBtn.enabled = false;
protected function ipCatalogDG_clickHandler(event:MouseEvent):void
if (ipCatalogDG.selectedIndex !=-1) {
addBtn.enabled = true;
deleteBtn.enabled = false;
// determine the price per project
[Bindable]
private var totalPrice:Number = 0.0;
private function sumUpColumn():void
var i:uint
totalPrice = 0.0;
for(i=0; i<usedIP.length; i++) {
totalPrice += (usedIP.getItemAt(i).cost);
]]>
</fx:Script>
<fx:Declarations>
<mx:CurrencyFormatter id="usdFormatter" precision="0" currencySymbol="$"
  decimalSeparatorFrom="." decimalSeparatorTo="." useNegativeSign="true"
  useThousandsSeparator="true" alignSymbol="left"/>
</fx:Declarations>
<s:Panel title="Project dropdownlist checking for filtering"
width="100%" height="100%">
<s:VGroup width="100%" height="100%" left="120" top="5">
<mx:HBox>
<s:DropDownList id="DropDownListProjects"
width="200"
dataProvider="{projects}"
labelField="label"
prompt="Select Project"
change="handleProjectSelected(event)" textAlign="left"/>
</mx:HBox>
<mx:HBox verticalAlign="middle">
<mx:DataGrid id="ipCatalogDG" dataProvider="{ipCatalog}" width="400" click="ipCatalogDG_clickHandler(event)"/>
<mx:VBox horizontalAlign="center">
<s:Button id="addBtn"
  label="Add to Project"
  click="addBtn_clickHandler(event)"
   width="130"
   enabled="false"/>
<s:Button id="deleteBtn"
  label="Delete from Project"
  click="deleteBtn_clickHandler(event)"
   width="130"
   enabled="false"/>
</mx:VBox>
<mx:DataGrid id="usedIPDG" dataProvider="{usedIP}" width="400" click="usedIPDG_clickHandler(event)"/>
</mx:HBox>
<s:Label id="totalProjectPrice"
text="The total price for this Project is : {usdFormatter.format(totalPrice)}"
visible="false"/>
</s:VGroup>
</s:Panel>
</s:Application>

Many thanks for this hint
Actually I went thru this video series already but probably forgot about it.
Now the training shows the methods for
HTTPService
RemoteObject
WebService
they have a slightly different result handler compared to the PHP method
I think, as I am using PHP, I am getting back generic objects (tried out on the "test server data"), so I would conclude I have to write something to the direction of
protected function xyze_resultHandler(event:ResultEvent):void
employees = event.result as ArrayCollection;
with employees being the arrayCollection that I will use then for filtering and interfacing with the datagrid thru binding
Is this correct?
sorry to bother you with my little knowledge level so far on flex
Peter

Similar Messages

  • I have three iPhone 4 models purchased in late 2010 that all share the same iTunes account (apps, music, etc), but I can only update the software on one of the three iPhones. What is the best solution to manage these devices for software updates, apps?

    I have three iPhone 4 models purchased in late 2010 (for my family) that all share the same iTunes account for access to apps and music, but each phone/user still has his/her custom contact list, email accts, and select lists of apps and music from the one iTunes acct library.  The problem is I can only update the software on one of the three iPhones – the primary phone I used to setup the iTunes acct. What is the best solution to manage these devices for software updates, apps? This is probably a common problem with families wanting to share apps and music without realizing the issues created by this approach. As it stands today... the first (primary) iPhone associated with the iTune acct has been updated with the latest software version 5.1.1 and sync'd up with all the apps, music, etc from the one iTune acct, while the other two iPhones are still running on the original software version 4.0.2 and are experiencing problems now. I was advised by AT&T back in January that it would be necessary to setup separate iTunes accts for the second and third iPhones in order to receive system updates. The problem would be how to keep all the apps, etc from being deleted off the second and third phones that were originally loaded from the one iTunes acct. Since this AT&T advice was prior to iCloud coming out, would iCloud be a better solution or at least part of the solution? I really don't yet understand how iCloud works. Hopefully, someone out there can help me??  Please?

    I have three iPhone 4 models purchased in late 2010 (for my family) that all share the same iTunes account for access to apps and music, but each phone/user still has his/her custom contact list, email accts, and select lists of apps and music from the one iTunes acct library.  The problem is I can only update the software on one of the three iPhones – the primary phone I used to setup the iTunes acct. What is the best solution to manage these devices for software updates, apps? This is probably a common problem with families wanting to share apps and music without realizing the issues created by this approach. As it stands today... the first (primary) iPhone associated with the iTune acct has been updated with the latest software version 5.1.1 and sync'd up with all the apps, music, etc from the one iTune acct, while the other two iPhones are still running on the original software version 4.0.2 and are experiencing problems now. I was advised by AT&T back in January that it would be necessary to setup separate iTunes accts for the second and third iPhones in order to receive system updates. The problem would be how to keep all the apps, etc from being deleted off the second and third phones that were originally loaded from the one iTunes acct. Since this AT&T advice was prior to iCloud coming out, would iCloud be a better solution or at least part of the solution? I really don't yet understand how iCloud works. Hopefully, someone out there can help me??  Please?

  • [Sales/Shipment report] - What's the best solution?

    Hello everybody.
    I have to develop a report with some sales data, delivery service data and shipment costs data.
    I have the cubes: 0SD_C03, 0SD_C04, 0LES_C02.. and I thought to do a multicube, but I don't no how to link these cubes...
    I don't have, for example, Sales Document/Item and/or Delivery Document/Item in all os these cubes...
    What is the best solution to this sittuation?
    I thought in some solutions like...
    1 - Extend extractor of 0LES_C02 to include Sales Doc/Item, but I don't know if all delivery doc is related to a sales doc.
    2 - I know I have all the fields that I want in the tables VBAP and LIPS...so I thought in create an generic extractor with a view of these two tables, and than creat a Z cube, to receive these datas...
    I really don't know whats the best solution, or if there is abother solution to this....
    I'll apreciate ideas, or a solution from someone that already face with this and developed a solution.
    Best Regards,
    Thiago

    Hi,
    Its better for you to add sales order,item in the cubes also from the source where your cube gets data ie from DSO as they are only point through which you can combine sales,delivery and billing data.
    Thanks,
    Arun

  • What's the better approach?

    Hi, I was just making a program that access a DB through JDBC, and I got myself into this dilemma
    What's the better approach to make a connection to a DB?
    approach #1(use of singleton pattern)
    import java.sql.*;
    public class DBConnection {
        private ResultSet rs;
        private Connection conn;
        private PreparedStatement ps;
        private static boolean singleton = false;
        private DBConnection() throws Exception{
            Class.forName("driverPath").newInstance();
         conn = DriverManager.getConnection("url", "user", "pass");
         singleton = true;
        public static DBConnection getInstance() throws Exception{
            if(singleton)
             return null;
            return new DBConnection();
        protected void finalize() throws Throwable {
            //close the connection and release resources...
            singleton = false;
        //Methods to make DB querys and stuff.     
    }approach #2 (make a connection only when doing querys)
    public class DBConnection {
        private ResultSet rs;
        private Connection conn;
        private PreparedStatement ps;
        public DBConnection() throws Exception {
            Class.forName("driverPath").newInstance();
        //Just some random method to access the DB
        public ArrayList<Row> selectAllFromTable() {
            ArrayList<Row> returnValue = new ArrayList<Row>();
         try {
             conn = DriverManager.getConnection("url", "user", "pass");
             //make querys and fill the arraylist with rows from the table
         } catch(Exception ex) {
             returnValue = null;
             ex.printStackTrace();
         } finally {
             if(ps != null)
                 ps.close();
                if(rs != null)
              rs.close();
             if(conn != null)
              conn.close();
         return returnValue;
    }I know this classes maybe don't even compile and I don't handle the Exceptions, I'm just trying to make a point about how to manage the connection
    So, what it's the better approach in your opinions? #1? #2? neither?

    Hi,
    I'm resurrecting this thread to ask is this approach OK?
    I'm trying to make a single MySql JDBC connection accessible throughout the model.
    I'm planning to use it in a Swing application. Whilst I realise the Swing apps are inherently multi-threaded, everything I plan to do can (I think) be done within the constraint that all access to model happens on the EDT, and the user will just have to wear any unresponsiveness.
    package datatable.utils;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    abstract public class MySqlConnection {
         public static final String URL = "jdbc:mysql://localhost/test";
         public static final String USERNAME = "keith";//case sensitive
         private static final String PASSWORD = "chewie00";//case sensitive
         private static final Connection theConnection;
         static {
              String driverClassName = "com.mysql.jdbc.Driver";
              try {
                   Class.forName(driverClassName);
                   theConnection = DriverManager.getConnection(URL, USERNAME, PASSWORD);
              } catch (Exception e) {
                   throw new DAOException("Failed to register JDBC driver class \""+driverClassName+"\"", e);
         public static Connection get() {
              return(theConnection);
    }Is there a better solution short of c3po? Which I played with, but couldn't work out how to configure.
    Thanx guys (and uj),
    keith.

  • What is the best solution for running windows based programs

    I have one program that I need windows for.  What is the best solution for doing this without painfully slowing down my mac.

    Depends on your needs.
    BootCamp requires reboot and uses all physical resources of the system.  Only OSX *or* Windows can run.  Better for gaming or memory intensive tasks.  BootCampAssistant must set up the boot sector to make it work.  Also BCA required to remove it.
    VM (virtual machine) like Parallels which "hosts" Windows while still running OSX.  You split RAM between the two environments.  VM is just another program so no special boot sector changes needed, but not good for graphics or RAM intensive programs.
    Other recommended alternates to Parallels (paid) are VM Fusion (paid) and VirtualBox (free download from Oracle.com).

  • What is the better printer the c4680 or the c5180

    What is the better printer the c4680 or the c5180

    Hi,
    What do you mean by better ? I would buy the C4680 for its support
        http://support.hp.com/us-en/product/HP-Photosmart-C4600-All-in-One-Printer-series/3739148/model/3739...
    Not the other:
      http://support.hp.com/us-en/product/HP-Photosmart-C5100-All-in-One-Printer-series/1153538/model/1153...
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • I wonder to know what is the enterprise solution for windows and application event log management and analyzer

    Hi
    I wonder to know what is the enterprise solution for windows and application event log management and analyzer.
    I have recently research and find two application that seems to be profession ,1-manageengine eventlog analyzer, 2- Solarwinds LEM(Solarwind Log & Event Manager).
    I Want to know the point of view of Microsoft expert and give me their experience and solutions.
    thanks in advance.

    Consider MS System Center 2012.
    Rgds

  • What are the standard Solutions available for Complaints Management in CRM?

    Dear all,
    What are the standard solutions available in SAP CRM to receive and process complaints through Customer Interaction Center.
    Our requirement is to receive and register complaints from contact center and process them by integrating back end ECC and BIW systems.
    As per my understanding we can not integrate ECC transactions in CASE Management while CASES are being created through Interaction Center.
    Please help me to map the following requirement successfully into SAP.
    How to register the complaint through Interaction Center?
    How this complaint information is communicated in back end ECC system?
    How to track the status and solution of the complaint available in back end ECC system?
    How the complaints are stored in ECC system?
    After creation of a complaint, can we trigger an automatic email on back end ECC system user with all complaint relevant data?
    Kindly help me to understand the process.
    Best regards,
    Raghu ram.

    You can analyse this [link |http://help.sap.com/saphelp_crm60/helpdata/en/68/691976cd2ef845a4e62437a82b67df/frameset.htm]for more information. Additionaly the tree hierarchy links contain some process flows where it explains you briefly the big picture of the process, in standard SAP CRM Complaint Manaagement Scenario.
    BR,
    Cenk Sezgin

  • Sometimes my computer takes too long to connect to new website. I am running a pretty powerful work program at same time, what is the best solution? Upgrading speed from cable network, is it a hard drive issue? do I need to "clean out" the computer?

    Many times my computer takes too long to connect to new website. I have wireless internet (time capsule) and I am running a pretty powerful real time financial work program at same time, what is the best solution? Upgrading speed from cable network? is it a hard drive issue? do I only need to "clean out" the computer? Or all of the above...not to computer saavy.  It is a Macbook Pro  osx 10.6.8 (late 2010).

    Almost certainly none of the above!  Try each of the following in this order:
    Select 'Reset Safari' from the Safari menu.
    Close down Safari;  move <home>/Library/Caches/com.apple.Safari/Cache.db to the trash; restart Safari.
    Change the DNS servers in your network settings to use the OpenDNS servers: 208.67.222.222 and 208.67.220.220
    Turn off DNS pre-fetching by entering the following command in Terminal and restarting Safari:
              defaults write com.apple.safari WebKitDNSPrefetchingEnabled -boolean false

  • What is the better way to change name of a site with paths and links?

    Hi!
    i m using dreamweaver cs4 and i have a site already configured on dreamweaver
    i need to change the name of the site and at the same time, every path names and every links
    This site has about 50 pages so i would like to know what is the better steps to do for modified the name of the site unless problem?
    I read the informations about  'manage site' but its not clear for me about links and path names!!
    thank you

    Just use site manager to change the site name. Nothing complicated with that.
    What exactly do you mean by changing path names? Do you want to change the name of folders in the site? If so, just change them within DW and it will prompt if you want to update links.

  • I have problems in the initiation of the Encore process when opening presents the following error message : "Encore CS6 Cannot Run in Non-Royalty Serialized".... What is the best solution for this problem ?

    Help Me.
    What is the best solution for this problem ?

    Encore is activated when you activate Premiere Pro... so, as Stan asked, how did you install P-Pro?
    Ask for serial number http://forums.adobe.com/thread/1234635 has a FAQ link
    -and a fix for Encore http://forums.adobe.com/thread/1421765?tstart=0 in reply #7
    -plus more Encore http://helpx.adobe.com/encore/kb/cant-write-image-fie-larger1.html

  • What's the better order to install OEM + AS + DB

    Hi everbody.
    What's the better order to install on RHEL4 Update2:
    - Enterprise Manager Control Grid (10gR2)
    - Database (10gR2)
    - Application Server (10gR3)
    And about the $ORACLE_HOME?? How to? Each instalation have a separate $ORACLE_HOME??
    Tks!

    Rafael,
    Save the Grid Control as the last installation. The order of Database and Application Server doesn't matter, however I would personally install the database first.
    Please read all Installation Guides' before starting any installations, and follow all pre-requisites stated for RHEL4.
    The Installation Guide's states that all products must be installed in separate ORACLE_HOME. As a matter of fact, the Oracle Installer doesn't allow installing any of these products into an existing ORACLE_HOME.
    Regards,
    Martin

  • I have installed HP2035n. But when i try to open the embedded web server, i get the error "Firefox doesn't know how to open this address, because the protocol (fe80) isn't associated with any program." What is the possible solution?

    I have installed HP2035n. But when i try to open the embedded web server, i get the error "Firefox doesn't know how to open this address, because the protocol (fe80) isn't associated with any program." What is the possible solution?
    I typed in the IPv6 address of the printer in the address feild of firefox.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    Do a malware check with some malware scanning programs.<br />
    You need to scan with all programs because each program detects different malware.<br />
    Make sure that you update each program to get the latest version of their databases before doing a scan.<br />
    * http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    * http://www.superantispyware.com/ - SuperAntispyware
    * http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    * http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    * http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also:
    * "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

  • What are the better load/performance testing tools available for Flex Application with BlazeDS RO?

    In my application is designed with Flex3, ActionScript3, BlazeDS Remote Objects.
    Just i tried with OPENSTA but i cant do the dynamic parameterization in their generated scripts because the response of the calls is binary values and also we cant get the response using with SCL language.
    While testing with OPENSTA with HttpService, i can do the dynamic parameterization and got the response.
    can give the information about the below questions
    whether we can do dynamic parameterization with OPENSTA for Flex Remote objects?
    and  what are the better load/performance tools available for Flex Remote Objects?

    Your approach is fine, depending on how many and what type of CFCs you are talking about. If they are "singletons" - that is, only one instance of each CFC is needed to be in memory and can be reused/shared from multiple parts of your application - caching them in the application scope is common.  Just make sure they are thread safe ("var" or local.* all your method variables).
    You might consider taking advantage of a dependency injection framework, such as DI/1 (part of the FW/1 MVC framework), ColdSpring, or WireBox (a module of the ColdBox platform that can be used independently).  They have mechanisms for handling and caching singletons.  Then you wouldn't have to go to the application scope to get your CFC instances.
    -Carl V.

  • How to map journal fields and whats is the better  process type

    /Journal/JournalSuspenseCostCentre     NULL
    /Journal/JournalBalancingCentre     Lookup from Organisation ID
    /Journal/JournalMultiCompany     u2018Nu2019
    /Journal/JournalBatchNumber     NULL
    /Journal/JournalNumTransactions     Total number of /Journal/JournalLine transactions
    /Journal/JournalBaseDRTotal     Sum of /Journal/JournalLine/JournalLineBaseValue u2013 Debit Values only
    /Journal/JournalBaseCRTotal     Sum of /Journal/JournalLine/JournalLineBaseValue u2013 Credit Values only
    How to map journal fields and whats is the better  process type idoc/proxies?please let me know
    Journal Line
    Multiple journal lines per header:
    Schema Element     Data
    /Journal/JournalLine/JournalLineCostCentre     Bank account control Cost Centre
    /Journal/JournalLine/JournalLineAccount     Bank account control Account Code
    /Journal/JournalLine/JournalLineMoneyTotal     Transaction Line Amount
    /Journal/JournalLine/JournalLineVolume     NULL
    /Journal/JournalLine/JournalLineDescription     Payee Name
    /Journal/JournalLine/JournalLineChequeBookReference     NULL
    /Journal/JournalLine/JournalLineMatchField     Cheque Number
    NB Contra accounting entries should be posted to:
    Schema Element     Data
    /Journal/JournalLine/JournalLineCostCentre     Bank account control Cost Centre
    /Journal/JournalLine/JournalLineAccount     Bank account control Account Code
    /Journal/JournalLine/JournalLineMoneyTotal     Transaction Line Amount * -1
    /Journal/JournalLine/JournalLineDescription     Payee Name
    /Journal/JournalLine/JournalLineMatchField     Cheque Number
    /Journal/JournalPeriod     Current General Ledger Period
    /Journal/JournalYear     Current General Ledger Year

    It looks you are new to PI,
    you have to develop scenario end to end, by creating source data type and target data type(if you have XSD's not required),then use Graphical mapping (message mapping) to map source and target structures.
    Search in sdn for one end to end scenario you will understand easily
    Regards,
    Raj

Maybe you are looking for