What to expect in upcoming SmartNSF Beta 3 release?

Posted on

EDIT: Beta 3 has been released: https://openntf.org/main.nsf/project.xsp?r=project/SmartNSF/releases/CCB…

Changes

We’ve decided to rename strategies to make the names shorter, yet still descriptive enough. We’ve basically removed all SELECT_ and ALL_ parts of the names. For example SELECT_ALL_DOCUMENTS_FROM_VIEW is from now on DOCUMENTS_FROM_VIEW. Extending the life of your keyboard is just a positive side effect of this change.

Bug fixes

Date format of returned DATETIME items was broken, so we fixed it. Bigly!

ARRAY_OF_DOUBLE data type was returning array of nulls instead of array of actual double values. Not exactly convenient, especially when you hadn’t stored nulls there in the first place.

New features

For DOCUMENTS_FROM_VIEW_BY_KEY and DOCUMENTS_FROM_VIEW_BY_KEY_PAGED strategies you can now specify mode('exact') in routes.groovy. Use it when you want to get just those documents exactly matching that specified key, same as calling view.getAllDocumentsByKey(key, true). If omitted, partial mode is used - so like view.getAllDocumentsByKey(key, false).

VIEWENTRIES and VIEWENTRIES_PAGED strategies has been added and they are quite fast. These allow you to define which view columns from the view you want to return, by programmatic name. Example routes.groovy can look like this:

router.GET('entries') {
  strategy(VIEWENTRIES\_PAGED) {
    viewName('ByTopic')
  }
  mapJson 'Subject', json: 'title', type: 'STRING'
  mapJson '\\$101', json: 'created\_date', type: 'DATETIME'
  mapJson '\\$110', json: 'price', type: 'DOUBLE'
}

Note the need to escape $ when programmatic name of the column contains it.

You can only use these strategies to read (GET) data from view, no formulas can be used and supported datatypes are STRING, DATETIME and DOUBLE. For multi-value columns use ARRAY_OF_STRING, ARRAY_OF_DATETIME and ARRAY_OF_DOUBLE.

As usual (well not so usual, to be frank, but we are working on it), you can find all these changes and more documentation in project wiki https://wiki.openntf.org/display/XRAPI/SmartNSF