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.

Comments

25 Responses to “SalesBuilder on AIR: Local Database, Data Sync, and Native Drag-and-Drop”

  1. Edouard Janssens on June 15th, 2007 2:56 am

    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. Christophe Coenraets » AIR-to-Desktop Drag-and-Drop: Two Simple Utility Classes on June 15th, 2007 11:59 am

    [...] 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… [...]

  3. Russ on June 15th, 2007 12:01 pm

    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

  4. christophe on June 15th, 2007 12:22 pm

    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

  5. gianfranco on June 15th, 2007 1:01 pm

    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″.).

  6. christophe on June 16th, 2007 6:14 am

    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

  7. Jhecht on June 16th, 2007 5:20 pm

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

  8. hxnozgsmun on June 21st, 2007 10:29 pm

    Hello! Good Site! Thanks you! tjchdhxkzw

  9. links for 2007-06-27 « thebadtiming on June 27th, 2007 4:33 pm

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

  10. BlueOceanCruiser on July 3rd, 2007 9:05 am

    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!

  11. GoGolfer on July 12th, 2007 8:32 am

    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

  12. Bo on July 24th, 2007 6:27 am

    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?

  13. Danko on August 6th, 2007 7:59 am

    Great windowing!!

  14. BruceH on August 16th, 2007 2:48 pm

    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.

  15. Drag and Drop in AIR | Adobe AIR Tutorials on August 24th, 2007 12:12 am
  16. Cloth on September 21st, 2007 3:32 pm

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

  17. Pens on September 27th, 2007 3:37 am

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

  18. pens on September 29th, 2007 1:02 am

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

  19. shoes on October 2nd, 2007 5:08 am

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

  20. cod3master on November 15th, 2007 9:49 am

    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.

  21. mahi on February 15th, 2008 11:00 pm

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

  22. akorcu.net on February 18th, 2008 1:57 pm

    thanks. nice jop

  23. ламинат on August 24th, 2008 11:00 pm

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

  24. Jitendra on October 13th, 2008 12:20 pm

    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…

  25. Nona on December 25th, 2008 7:08 am

    Not so good as before.

Leave a Reply