Learning Employee Directory: How to add a field to employee data?

55 sec read

Return to table of contents

Let’s say you want to modify Employee Directory for your own company and you want to add another filed (fax) to the employee data. How to do this?

In EmployeePanelDetail.mxml, add the following block.

<!-- fax -->
<mx:HBox id="faxBox" width="100%" verticalAlign="top" horizontalGap="4">
<mx:Canvas width="100">
<mx:Label right="0" text="Fax:" styleName="dataPanelLabel" />
<mx:Text text="{ employee.fax }" styleName="dataPanelText" selectable="true" width="165" />

In Employee.as, add

/** fax **/
public var fax : String;

In EmployeeCSVParser.as, add

employee.fax = (itemArr[15] != '' ? itemArr[15]:null);

In InsertEmployeeDataCommand.as, add fax column

stmt.text = "INSERT INTO employee ('id', 'firstName', 'lastName', 'displayName', 'title', 'department', 'managerId', 'email', " +
"'phone', 'phoneExtension', 'fax', 'cellPhone', 'deskLocation', 'location', 'city', 'state', 'postalCode', 'countryCode') " +
" VALUES (:id, :firstName, :lastName, :displayName, :title, :department, :managerId, :email," +
" :phone, :phoneExtension, :fax, :cellPhone, :deskLocation, :location, :city, :state, :postalCode, :countryCode);";
stmt.parameters[":fax"] = employee.fax ;

In InitDatabaseCommand.as, change

var stmtText : String = "CREATE TABLE employee( id TEXT, firstName TEXT, lastName TEXT, displayName TEXT, title TEXT, department TEXT" +
", managerId TEXT, email TEXT, phone TEXT, phoneExtension TEXT, fax TEXT, cellPhone TEXT, deskLocation TEXT, " +
" location TEXT, city TEXT, state TEXT, postalCode TEXT, countryCode TEXT )";

The sample data are in employee.csv. So append another column in this file. In this column, fill in the fax info for every employee.

Then compress employee.csv to employee.csv.zip; replacing the original employee.csv.zip in samplehtdocs under src.

Then clean your project (removing contents from folder bin-debug).

Clean the old data in C:\Documents and Settings\Xu Cui\Application Data\employeedirectory\Local Store (change Xu Cui to your own directory)

Build and run your application. It will be fine.


Want to receive new post notification? 有新文章通知我

How much money did I make from an app?

Undoubtedly some people are very successful in making money by developing a smartphone app. Back in 2012 I developed an app called “Handbook of Brain” which is a collected resources of brain anatomy, function and diseases. I put the app i
Xu Cui
27 sec read

Handy programs to visualize NIRS data (2): plotTopoMap

Often you need to view the spatial pattern of activation as in the example below. plotTopoMap allows you to do that. It probably only works for Hitachi devices where the spatial relationship between channels are known. In the above example, the activ
Xu Cui
37 sec read

Flash 3D video demo

Racer Ostrova Zombie
Xu Cui
0 sec read

17 Replies to “Learning Employee Directory: How to add a field to…”

  1. First, thank you for your explanations. I attempted to add a field to the confrence room as you described for employees, but keep getting an error that the table conferenceroom has no field ‘admin’ which is the field I am adding. I did append the field, added it to each area where it belonged, and located the “old data” although mine was in a ‘Roaming’ folder (I use Vista). Any idea why it won’t accept the new field?

  2. Hi, Maris, did you
    [1] modify InitDatabaseCommand.as to include your new field?
    [2] delete your “old data” in your application storage directory AND in your bin-debug directory?

  3. Thank for the reply, cuixu. Apparently there is more data hiding somewhere within the Vista world. I used my XP computer, and had no problem finding and deleting the data storage, which forced the application to create new tables.

    Now to figure out how to add another slide out detail page that shows data from a different table. Wish me luck!

  4. Great Tutorial!

    How do you go about displaying numerous values in the same field, i.e. multiple supervisors/departments listed in the same field. Is that even possible?

    Thank you!


  5. Amazing Tut, can you please explain how to create a Dynamic field (i.e. Department, Manager, Direct Reports) when you have time???

    Thanks again!

  6. Hi,

    I am using the latest ED so it might be a bit different but i follow the tutorial and all the files were there, i added many fields and they show but it doesn’t fetch the info from my csv.zip….

    Now that raise the questions i had from the start…

    How does ED knows which row in the excel file to take the info?

    My assumption is that it calls the
    [employee.email2 = (itemArr[16] != ” ? itemArr[16]:null);]

    that would be row 16 in the excel file? but i ve got no clue if i am right because it doesn’t seem to work

    2nd question related to that is that there seems to already have the cellphone option but it doesn’t show in the app either!?

  7. @foxchx
    Q1: My understanding is that ED hard-coded the association of column number with a certain field.
    Q2: In the version I have, EmployeeCSVParser.as doesn’t get cell phone info at all.

    btw, you need to clean the data after changing the csv.zip file.

  8. @Xu Cui

    What do you mean by hard-cored?

    For the cell phone thingy, it is the same in the new version EmployeeCSVParser.as does not reffer to cellphone anywhere, but every other files to edit already have the cellphone entry. what puzzle me is that it doesn’t show at all but the coding is there as if they only omited to include it in EmployeeCSVParser.as?!?!

  9. @foxchx

    I mean column 1 is for first name, etc

    I agree it’s strange. You can add some lines in EmployeeCSVParser.as to pass the cell phone info.

  10. @Xu Cui
    that’s what i did, hoping that it works…

    You know you were mentioning the cleaning… i guess i messed it up when cleaning because now i get and error 3115 so it doesn;t fetch my data anymore…i have to figure what that error before i can see if the cellphone thingy works.

  11. Hello everybody I am changing my business for ED but I need someone
    say where it is stored in the database and how do I physically add
    new tables and queries directly to the new tables.
    And also used as backup only the files csv.zip
    In advance that I can help will thank you, thank you in advance.

  12. @Alberto Villegas
    Dude welcome aboard, i am doing the same here, we might want to help eachother because damn it’s not easy! hehe

    The workflow describe in this post works, but i still need to tweak it because it doesn’t recongnize which new colums is which in the csv.zip file.

    meanwhile, i do have a direct question about a simple tweak that i would like to do…

    /** A 10-digit external phone number. **/
    public var phone : String;

    Where can I change the 10 digit to say, 12-14 ? this string as a restriction of 10 digit but i don’t know yet how to change these strings properties?


  13. Xu Cui Here’s a question for you…

    I am trying to implement chinese(mandarin) names in the adobe employee directory but i only get ???? instead?

    Any Ideas?

  14. @foxchx
    I’m not sure if font is the problem. ED uses a special font (Myriad I remember) which doesn’t encode Chinese.

    I have tried using Chinese in other applications and it works fine (though the display is not beautiful).

  15. Well, back on that ED thing, managed to break down a bunch of stuff over time, but one thing stands…..MANADARIN!!

    I had to download a jam packed “ARIAl 22mb” freak font but at least now the app works fine in any languages.

    The problem with ED is that they use CSV to feed the data to the DB….CSV don’t allow Chinese from exel for some reason. So apparently I have to edit the tables by hand, and that just can’t be, why using a DB is you have to enter every entries one by on!@#%??

    XU Cui i hope you can help me on that, you might have had that problem in the past?

  16. I’m not sure why ED uses CSV to store data. I would use sqlite directly. So if you are building a real life application based on ED, I think you may consider the possibility of removing the CSV part. Then you don’t have to worry about the language/font any more.

Leave a Reply

Your email address will not be published. Required fields are marked *