SalesBuilder on AIR: Local Database, Data Sync, and Native Drag-and-Drop

NOTE: This version of the application is now obsolete. I posted a new and significantly improved version here.

airsb.png

SalesBuilder is a sample Sales Force Automation application that allows you to work offline (using the SQLite database embedded in the AIR runtime), and synchronize data with the server when you are back online.

In addition to using a local database, SalesBuilder also demonstrates other interesting features such as native drag-and-drop between an AIR application and the desktop, as well as native drag-and-drop between an AIR application and other desktop applications such as Word and Excel.

This is the AIR version of the browser-based application I recently posted here. The database-related instructions below are therefore very similar.

In this hosted version, I removed the server component (to avoid having to watch all the bad things that can happen to a shared demo database). An XML document plays the role of server data. You work offline and the changes you make are saved to your local SQLite database. A simple data synchronization mechanism allows you to initially populate your local database, and informs you of the changes that would be sent to the server.

Click here to install the application.

Guided Tour

Working with the local database

  1. Start the application.
  2. Click the Search button in the left drawer. Notice that there is no data (you haven’t populated your local database yet).
  3. Optionally start the AIR SQLite Admin tool.
    • Click “Open Database”
    • Navigate to your “Application Data\salesbuilder\Local Store” directory, select salesbuilder.db and click Open.
    • Click “New Query” in the menu bar.
    • Type “select * from account” or “select * from contact”: no data.
  4. In the SalesBuilder app, click the “Sync” button in the menu bar.
  5. When the synchronization process completes, click the “Search” button again: You now have data.
  6. If you started the SQLite Admin tool, click the “Execute” button again and notice that your local database has been populated.
  7. In the SalesBuilder app, double-Click “Acme” in the search results.
  8. Note that this is an MDI type of user interface. The list of open windows (panels) is available under “Open Items” in the drawer. You can click an item to restore it.
  9. Make some changes to the Acme data (for example, change the phone number), and click “Save”.
  10. Click the Sync button again and notice that the change you just made is picked up by the synchronization process.
  11. On the Contacts tab, you can grab an org chart item with the mouse and move it around.
  12. To open the details view for a contact, either double-click an org chart item or click “Show Grid” and double-click a contact in the datagrid.
  13. On the Market History tab, you can grab the chart with the mouse and move it left and right, adjust the time selection using the dividers in the bottom chart, etc.
  14. Continue to add and modify accounts and contacts, and click the Sync button to see the changes being picked up by the synchronization process.

Native drag-and-drop

  1. Click “Dashboard” in the menu.
  2. Drag any of the three charts and drop it on the desktop: the chart is saved as a JPG on the desktop.
  3. Open a Word document, drag a chart from the application again, and, this time, drop it directly in the Word document.
  4. Click the grid view icon for any of the three charts.
  5. Select some rows in the datagrid, and, without releasing the mouse button, drag the selected rows and drop them on the desktop. The rows are saved as an Excel document on the desktop.
  6. Double-click the Excel document to open the spreadsheet.
  7. Drag some rows from the Datagrid again, and, this time, drop them directly somewhere in the Excel spreadsheet.

Source Code and Disclaimer

Click here to download the source code of the application.

This sample is a proof of concept and not a full featured application. Some modules of the application (like opportunities and activities) are not implemented in this version.

Credits to Mark Shepherd for the Springgraph component used for the org chart.

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • LinkedIn
  • StumbleUpon
  • Twitter
This entry was posted in Flex. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

22 Comments

  1. Edouard Janssens
    Posted June 15, 2007 at 2:56 am | Permalink

    Excellent work !

    Is there a way the do the opposite Drag and Drop ?
    For example dragging a jpeg from the desktop to a list in an Air application ? Or a text snippet to a text area ? Or a url bookmark to a datagrid or bookmarks, etc..;

    Tx.

  2. Russ
    Posted June 15, 2007 at 12:01 pm | Permalink

    I can’t seem to get the app to install, I get this error when I try
    This application could not be installed or launched (AIR file C:\DOCUME~1\Russ\LOCALS~1\Temp\salesbuilder-2.air is invalid: The digest for salesbuilder-profile.swf is broken).

    I just updated the run time to the AIR version

  3. christophe
    Posted June 15, 2007 at 12:22 pm | Permalink

    Russ,
    I tried the install on a few machines and don’t see that problem. What’s your configuration? Did you have a pre-beta version of Apollo/AIR installed? Did you uninstall it before installing the beta?
    Christophe

  4. Posted June 15, 2007 at 1:01 pm | Permalink

    I get this error :

    This application could not be installed or launched (AIR file C:\DOCUME~1\torgia00\IMPOST~1\Temp\salesbuilder-2.air is invalid: Unrecognized version namespace “http://ns.adobe.com/air/application/1.0.M4″.).

  5. christophe
    Posted June 16, 2007 at 6:14 am | Permalink

    Gianfranco,
    Can you confirm that you followed the instructions on the AIR install page? Specifically that you uninstalled any pre-beta version of Apollo/AIR before installing the beta.
    “If you are having trouble installing an AIR application and you previously installed the Apollo alpha, the Apollo alpha must be uninstalled before installing the Adobe AIR beta. Instructions for uninstalling the alpha on Mac and Windows are provided in the release notes.”
    Christophe

  6. Posted June 16, 2007 at 5:20 pm | Permalink

    I just installed the Apollo beta right over the alpha… Every app i’ve tried works fine for me.

  7. Posted June 21, 2007 at 10:29 pm | Permalink

    Hello! Good Site! Thanks you! tjchdhxkzw

  8. BlueOceanCruiser
    Posted July 3, 2007 at 9:05 am | Permalink

    Christophe, thanks for the wonderful example! There’s a lot of great stuff here that I want to learn how to add to my own projects. Are you planning to post any discussions on how you implemented some of these techniques. It’s a complex app and a little hard to follow (for a less skilled programmer like me) without some guidance/discussion. Anyway, thanks again for your efforts!

  9. Posted July 12, 2007 at 8:32 am | Permalink

    Hello Everyone,

    I am a golfer myself and I like to play whenever I get a chance.
    A short while ago, a very good friend of mine told me about a great golfing equipment and accessories website that has discounted prices on all their products, same day shipping in most cases and there is no state sales tax, they are paying that.
    So if any golfer here is ready to save some money on quality products at highly discounted prices, you might want to check out their site at; http://hoffmangolf.com

  10. Bo
    Posted July 24, 2007 at 6:27 am | Permalink

    Hi,

    Great article and can’t wait to get starting ‘deconstructing’ the application :) But – am I missing something here, or what does golf have to do with anything on this page?

  11. Posted August 6, 2007 at 7:59 am | Permalink

    Great windowing!!

  12. BruceH
    Posted August 16, 2007 at 2:48 pm | Permalink

    I work in CRM and this is the beginning of a very good application. The line blurring standard Web apps and Client/Server is on the way out. The ability to have your users have this app locally and sync data has been around but the drag and drop feature to bring their data so easily to their desktop is very powerful.

    If you continue improving this app, one thing I would suggest is make sure your Air. App Has e-mail capability. Sales People must have E-mail.

  13. Posted September 21, 2007 at 3:32 pm | Permalink

    Hello to all, its my new pages about cloth
    cloth diaper
    You can buy here 24\7.

  14. Posted September 27, 2007 at 3:37 am | Permalink

    Hello, here you can read all info about pen pal
    24\7.

  15. Posted September 29, 2007 at 1:02 am | Permalink

    Hello nice blog! !!
    pen
    It’s my new page.about pens.

  16. Posted October 2, 2007 at 5:08 am | Permalink

    Hello nice blog! !!
    pen
    It’s my new page.about shoes.

  17. cod3master
    Posted November 15, 2007 at 9:49 am | Permalink

    Very nice thing.

    I miss the AIR Version. You told that as soon AIR is released you will post it.

    I’m really interested how this works, since I also try to create a online / offline sync with AIR/Gears, but don’t see how AIR can interact with Gears, AIR has it’s own sqlite db.

  18. Posted February 15, 2008 at 11:00 pm | Permalink

    please any body help me….how to search the data from the data base..i need some source code.using hibernate,spring and velocity

  19. Posted February 18, 2008 at 1:57 pm | Permalink

    thanks. nice jop

  20. Posted August 24, 2008 at 11:00 pm | Permalink

    9iGood idea.4a I compleatly disagree with last post . nbi
    купить ламинат 2w

  21. Jitendra
    Posted October 13, 2008 at 12:20 pm | Permalink

    I got this error while installing the application :

    This application requires a version of adobe AIR which is no longer supported. Please contact application author for an updated version.

    give me some solution…

  22. Posted July 21, 2009 at 10:00 pm | Permalink

    Вот это да… После прочтения даже мне тема стала интересна.

4 Trackbacks

  1. [...] I have been using this feature in the SalesBuilder application I posted yesterday. In the process of building SalesBuilder I created two utility classes to abstract the details of generating bitmaps, XLS files, etc… [...]

  2. By links for 2007-06-27 « thebadtiming on June 27, 2007 at 4:33 pm

    [...] Christophe Coenraets » SalesBuilder on AIR: Local Database, Data Sync, and Native Drag-and-Drop (tags: flex apollo air adobe flash) [...]

  3. By Drag and Drop in AIR | Adobe AIR Tutorials on August 24, 2007 at 12:12 am
  4. [...] SalesBuilder on AIR: Local Database, Data Sync, and Native Drag and Drop [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>