07.04.2017

Unexpected results reading a plain text file with NotesStream in LotusScript (or when strings contain MORE than meet the eye)

Tags: LotusScript
0

This is a little LotusScript experiment with a plain text file and a LotusScript agent using NotesStream. After reading the text from the file I try to use the string to locate a document with a corresponding key in a NotesView. While everything looks fine in the debugger, something is not correct and the lookups fail. This article has some suggestions for solutions at the end but they are not state-of-the-art! Perhaps you know other ways?

First off, I have a super-simple plain text file with a single number in it;

SNAGHTML6c68e14

Then I have a super-simple LotusScript agent reading this text file, and trying to locate a Notes document with the same number from a NotesView.

SNAGHTML6c794b7

The documents have all their numbers stored as text, like this;

SNAGHTML6c802d2

Why stored as text? Because this is how I found the (to me) abnormality in the first place Smile And why NotesStream? Because code with the concept herein also runs on an iSeries, where it works fine …

The LotusScript-code looks like this;

SNAGHTML6d2928f

The code uses a NotesView (1) and a NotesStream (2) to open the file and read out the contents with the ReadText-method (3). Finally the code tries to locate the document in the NotesView first by a hardcoded key (4), and then by the value retrieved via NotesStream (5). In a moment you will see how the first works and the second not.

Tags

Calendar