Open, Transmitted, History

Overview TimeTracker Data Management


Local TimeTracker Data Management


Some background on TimeTracker’s local data management on BlackBerry device. If you’re using the TimeTracker Enterprise Edition there’s also data management at your backend to persist all the tracked times of all your employees. More Info here.

On your BlackBerry Device all data is stored inside secure sandbox of TimeTracker APP, so it’s invisible to others and secure. If running TimeTracker Enterprise and connected to a BES 10, then your app is running in encrypted work perimeter (adding some more security) and you also have a secure transport of data.


Some time ago I did some tests what’s the best way to persist data on a BlackBerry 10 Device from Cascades. Read more about it here at BlackBerry Developer Blog. TimeTracker also stores all data as JSON, because JSON isn’t only fast it’s also the best solution to send data between QML and C++, cache data in .json files or send JSON payload to REST Server.

I separated tracked data into different files:

  • cache values (JSON)
  • current running (JSON)
  • Open tracked data (JSON)
  • addon data from Location Services (JSON)
  • history per month (JSON)
  • signature images (single files in folder structure)

I did some tests: even creating new tracked data  every  10 minutes and having a history of 12 months files are small and access is fast.

Using JSON I don’t have to think about Table / Column definitions or mapping against objects and it’s easy to add a new property. That’s the good thing working schema free.

Some C++ code

Getting the list of tracked data:

JsonDataAccess jda;
QVariantList trackedList =

Ading a new Object and writing the list back to file:

trackedList.append(trackedData);, currentTrackedFilePath);

… really easy, but the best is the mapping between C++ and QML.

To display the list of tracked data in a ListView (see here) simply insert into data model.

QML Code

ListView {
    id: trackedList
    dataModel: GroupDataModel {
        id: dataModelTracked
        sortingKeys: [ "dayLocal", "hourMinuteLocal" ]
        grouping: ItemGrouping.ByFullValue
function initDataRO(data) {

QVariantList (C++) is automatically mapped to JSON Array (QML)

QVariantMap (C++) is mapped to JSON Object (QML)

So you can do stuff like this:

From QML create a JSON Object:

var myData = {}
myData.task = "some text"
myData.order = 42

and then use this Javascript Object from QML, invoke a C++ method and add as QVariantMap to QVariantList etc.

Take a look at Categories in ApplicationMenu Settings. You can define which fields are available, so one Category has properties ‘project’, ‘order’ and ‘task’ – other perhaps only ‘order’ or nothing. On a mobile device I always try to have objects as small as possible: if a Category doesn’t have ‘project’ I don’t insert something like ‘project’:”” – I insert nothing. This makes the files much smaller. Sometimes in UI logic (QML) I have to test if property exists: if(‘project’ in myData){ do something }

I really like this easy dealing with JSON from UI in QML to business logic in C++ to persist-as-file or send-as-payload-to-server.

Only for data with complex queries or big data or fulltext-search I’m using SQLite. Hopefully MongoDB will find the way to BlackBerry 10 Cascades – would fit perfect.