Friday, November 28, 2008

@GetField accepts text-list as input

Just out of curiosity, I tried using a text-list as input for @GetField. It works.
When a text-list is the input, a text-list of the field values is the output.

fields := "subject" : "com_unique" : "relation";
@Implode( @GetField( fields ) ; "|" )

The above code gives me a pipe-separated string of the values in the subject, com_unique and relation-field.

Not the most useful tip I've blogged about, but probably nice to know.. :)

Friday, November 21, 2008

Avoid save-conflicts in web applications

I had a problem with save-conflicts today.

In an app I work with, the users can modify the category a document belongs to from the document-editing interface. When the category is saved, all documents that belong to the category are updated with new paths.

Sometimes, when a user saved the document after modifying the category, a save-conflict would occur (I couldn't recreate the save conflict in Firefox for some reason, only IE).

I searched the forums for help, and found it (thanks, Erik C. Brooks). If you remove the %%ModDate front-end with Javascript, you avoid save-conflicts. I tested it, and it seems to work. To be somewhat on the safe side, I only remove the field when a category is being modified from the document-editing interface.

Simple code to remove the field:
var f = document.forms[0];
f.removeChild( f['%%ModDate'] );

Beware of NotesView.getColumnValues

It's probably undocumented for a reason (not complete?).

If you use this in a webapp, and run as web user, it ignores readers-fields, and returns all column values. This is similar to the LS Evaluate-behavior when you do @DbLookup/@DbColumn.

Also.. If you do NotesView.FTSearch, getColumnValues returns all values, instead of only the ft-search filtered values.

Simple function that does the same as NotesView.getColumnValues, safer, but a little slower:

Function columnValues( view As NotesView, Byval columnIndex As Integer ) As Variant
On Error Goto bubbleError

'Create empty dynamic array
columnValues = Split( "" )

Dim entryCol As NotesViewEntryCollection, entry As NotesViewEntry
Set entryCol = view.AllEntries
Set entry = entryCol.GetFirstEntry
While Not entry Is Nothing
If entry.IsValid Then
columnValues = Arrayappend( columnValues, entry.ColumnValues( columnIndex ) )
End If

Set entry = entryCol.GetNextEntry( entry )

columnValues = Fulltrim( columnValues )

Exit Function
Error Err, Err
End Function

Friday, November 14, 2008

Firefox plugin for testing XSL - XSL Results

I don't work much with XML transformations. Therefore I don't have any commercial XML tools available at my place of work.

I'm currently working with XML->DXL transformations. I scoured the web for some XSL tools. I found this nifty plugin for Firefox. It's fast, and works great. Highly recommended.

Tuesday, November 11, 2008

Added translation tool to my blog

Inspired by the code poet, I added a google-translate tool at the top right side of my blog.

Hopefully, this will let more people find a solution to their problem.

Regarding the templating-class/-demoapp.. I've implemented it in a couple of projects at work. It works great.. I'll post the demo-app when someone (the tooth ferry fairy?) has documented the code.