<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lotus Notes &#8211; Tjitjing Blog</title>
	<atom:link href="http://localhost/index.php/tag/lotus-notes/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.tjitjing.com/</link>
	<description>This is my blog on technology related stuff and on occation other things too...</description>
	<lastBuildDate>Fri, 11 Dec 2009 15:53:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.16</generator>
	<item>
		<title>Hide Empty Rich Text Field in Lotus Notes</title>
		<link>https://blog.tjitjing.com/index.php/2009/12/hide-empty-rich-text-field-in-lotus-notes.html</link>
					<comments>https://blog.tjitjing.com/index.php/2009/12/hide-empty-rich-text-field-in-lotus-notes.html#comments</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Fri, 11 Dec 2009 15:53:06 +0000</pubDate>
				<category><![CDATA[Lotus Notes]]></category>
		<category><![CDATA[Lotusscript]]></category>
		<guid isPermaLink="false">http://blog.tjitjing.com/?p=215</guid>

					<description><![CDATA[The problem is very simple: I want to hide a Rich Text field (RTF) if it is empty and show it if it has something in it, in my case one or more attachments. In Lotus Notes a Rich Text Field will not evaluate to empty even if it is emtpy so using a common&#8230; <a class="more-link" href="https://blog.tjitjing.com/index.php/2009/12/hide-empty-rich-text-field-in-lotus-notes.html">Continue reading <span class="screen-reader-text">Hide Empty Rich Text Field in Lotus Notes</span></a>]]></description>
										<content:encoded><![CDATA[<p><strong>The problem is very simple: I want to hide a Rich Text field (RTF) if it is empty and show it if it has something in it</strong>, in my case one or more attachments. In Lotus Notes a Rich Text Field will not evaluate to empty even if it is emtpy so using a common Hide-When forumula such as MyRTF=&#8221;&#8221; will not work and you can only use @Formulas.</p>
<p><strong>The solution:</strong></p>
<p>1) Create a new Numeric field, Computed for Display, Hidden, and with Value set to @ThisValue (or HideMyRTF if you are using an earlier release than ND6)  Lets call this field HideMyRTF in this example.</p>
<p>2) Set the Hide-When formula of your existing Rich Text Field &#8211; lets call it MyRTF in this example &#8211; simply to HideMyRTF (meaning if HideMyRTF is True then hide MyRTF)</p>
<p>3) Add some LotusScript using the <a href="http://www-12.lotus.com/ldd/doc/domino_notes/7.0/help7_designer.nsf/f4b82fbb75e942a6852566ac0037f284/0e1a24de5059f2f88525704a0040f2fb?OpenDocument" target="_blank" rel="noopener noreferrer">NotesRichTextItem</a> <a href="http://www-12.lotus.com/ldd/doc/domino_notes/7.0/help7_designer.nsf/2e73cbb2141acefa85256b8700688cea/474285929784b9738525704a0040f34d?OpenDocument" target="_blank" rel="noopener noreferrer">EmbeddedObjects property</a> to the Forms QueryOpen event. This will check if there are attachments or text in the field:</p>
<pre>Dim rtitem As NotesRichTextItem
Set rtitem = source.Document.GetFirstItem( "MyRTF" )
If Isempty(rtitem.EmbeddedObjects) And Trim(rtitem.Text) = "" Then
    source.Document.HideMyRTF = 1
Else
    source.Document.HideMyRTF = 0
End If</pre>
<p>That&#8217;s it.</p>
<p>It was a long time since I did any <a href="http://www.notes.net/" target="_blank" rel="noopener noreferrer">Lotus Notes development</a> so I&#8217;m a bit rusty. I&#8217;m sure I&#8217;ve come up with this or a similar solution in the past but I could not find any when searching so I had to start from the beginning.</p>
<p>This was for an existing app that has been around for quite a few years so there is no way for me to control anything from the beginning. I guess I could have used an agent to set some stuff but this would most likely cause tons of replication conflicts as there are tens of thousands of documents, still being updated by users and replicated across several servers.</p>
<p>Done with a Lotus Notes 7.02 client (I told you it&#8217;s been a while&#8230;) but should work on older and newer releases.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.tjitjing.com/index.php/2009/12/hide-empty-rich-text-field-in-lotus-notes.html/feed</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>How to sort a NotesDocumentCollection in Lotusscript</title>
		<link>https://blog.tjitjing.com/index.php/2006/05/how-to-sort-notesdocumentcollection-in.html</link>
					<comments>https://blog.tjitjing.com/index.php/2006/05/how-to-sort-notesdocumentcollection-in.html#comments</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Tue, 30 May 2006 21:28:00 +0000</pubDate>
				<category><![CDATA[Lotus Notes]]></category>
		<category><![CDATA[Lotusscript]]></category>
		<category><![CDATA[Domino]]></category>
		<category><![CDATA[IBM Lotus]]></category>
		<guid isPermaLink="false">http://blog.tjitjing.com/index.php/2006/05/how-to-sort-a-notesdocumentcollection-in-lotusscript.html</guid>

					<description><![CDATA[This Lotusscript function sorts a document collection on one or multiple fields. I have previously used several other algorithms that use a view to sort the collection, these however have the drawback that they become very inefficient (i.e. slow) as the number of documents in the view used for sorting grows. The solution presented below&#8230; <a class="more-link" href="https://blog.tjitjing.com/index.php/2006/05/how-to-sort-notesdocumentcollection-in.html">Continue reading <span class="screen-reader-text">How to sort a NotesDocumentCollection in Lotusscript</span></a>]]></description>
										<content:encoded><![CDATA[<p><strong>This Lotusscript function sorts a document collection on one or multiple fields.</strong></p>
<p><strong><br />
</strong><strong>I have previously used several other algorithms that use a view to sort the collection, these however have the drawback that they become very inefficient (i.e. slow) as the number of documents in the view used for sorting grows. The solution presented below does not have this problem. </strong></p>
<p>It has been developed and tested in Lotus Notes 6.5.3 but should work in all ND6 (release 6) and possibly earlier Lotus Notes releases too (if you test this successfully or unsuccessfully write a comment to this post and everyone will know).</p>
<p>Example of use:</p>
<p><code>Dim fieldnames(0 To 2) As String<br />
fieldnames(0) = "SKU"<br />
fieldnames(1) = "OrderDate"<br />
fieldnames(2) = "Client"<br />
Set collection = SortCollection (collection, fieldnames) </code></p>
<p>Function to sort DocumentCollection:</p>
<p><code>Function SortCollection(coll As NotesDocumentCollection, fieldnames() As String) As NotesDocumentCollection</code></p>
<p><code>' ------------------------------------------------<br />
' --- You may use and/or change this code freely<br />
' --- provided you keep this message<br />
' ---<br />
' --- Description:<br />
' --- Sorts and returns a NotesDocumentCollection<br />
' --- Fieldnames parameter is an array of strings<br />
' --- with the field names to be sorted on<br />
' ---<br />
' --- By Max Flodén 2005 - http://www.tjitjing.com/<br />
' ------------------------------------------------</p>
<p>Dim session As New NotesSession<br />
Dim db As NotesDatabase<br />
Dim collSorted As NotesDocumentCollection<br />
Dim doc As NotesDocument<br />
Dim i As Integer, n As Integer<br />
Dim arrFieldValueLength() As Long<br />
Dim arrSort, strSort As String<br />
Dim viewname As String, fakesearchstring As String</p>
<p>viewname = "$All" 'This could be any existing view in database with first column sorted<br />
fakesearchstring = "zzzzzzz" 'This search string must NOT match anything in view<br />
Set db = session.CurrentDatabase</p>
<p>' ---<br />
' --- 1) Build array to be sorted<br />
' ---</p>
<p>'Fill array with fieldvalues and docid and get max field length<br />
Redim arrSort(0 To coll.Count -1, 0 To Ubound(fieldnames) + 1)<br />
Redim arrFieldValueLength(0 To Ubound(fieldnames) + 1)<br />
For i = 0 To coll.Count - 1<br />
Set doc = coll.GetNthDocument(i + 1)<br />
For n = 0 To Ubound(fieldnames) + 1</p>
<p>If n = Ubound(fieldnames) + 1 Then<br />
arrSort(i,n) = doc.UniversalID<br />
arrFieldValueLength(n) = 32<br />
Else<br />
arrSort(i,n) = "" &amp; doc.GetItemValue(fieldnames(n))(0)<br />
' Check length of field value<br />
If Len(arrSort(i,n)) &gt; arrFieldValueLength(n) Then<br />
arrFieldValueLength(n) = Len(arrSort(i,n))<br />
End If<br />
End If</p>
<p>Next n<br />
Next i</p>
<p>'Merge fields into list that can be used for sorting using @Sort function<br />
For i = 0 To coll.Count - 1<br />
If Not strSort = "" Then strSort = strSort &amp; ":"<br />
strSort = strSort &amp; """"<br />
For n = Lbound(fieldnames) To Ubound(fieldnames) + 1<br />
strSort = strSort &amp; Left(arrSort(i,n) &amp; Space(arrFieldValueLength(n)), arrFieldValueLength(n))<br />
Next n<br />
strSort = strSort &amp; """"<br />
Next i</p>
<p>' ---<br />
' --- 2) Sort array<br />
' ---<br />
arrSort = Evaluate("@Sort(" &amp; strSort &amp; ")")</p>
<p>' ---<br />
' --- 3) Use sorted array to sort collection<br />
' ---<br />
Set collSorted = coll.Parent.GetView(viewname).GetAllDocumentsByKey(fakesearchstring)</p>
<p>For i = 0 To Ubound(arrSort)<br />
Set doc = db.GetDocumentByUNID(Right(arrSort(i), 32))<br />
Call collSorted.AddDocument(doc)<br />
Next i</p>
<p>' ---<br />
' --- 4) Return collection<br />
' ---<br />
Set SortCollection = collSorted</p>
<p></code><code>End Function<br />
</code></p>
<p><em>(This article is previously published and has been moved to this blog)</em><br />
<em></em><br />
<em>[Update: Instead of using Evaluate and @Sort in section 2 in the code you can of course use any of your favourite sort routines. Or search the Net for one, there are many out there.]</em></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.tjitjing.com/index.php/2006/05/how-to-sort-notesdocumentcollection-in.html/feed</wfw:commentRss>
			<slash:comments>18</slash:comments>
		
		
			</item>
	</channel>
</rss>
