{"id":95,"date":"2012-02-16T14:45:22","date_gmt":"2012-02-16T13:45:22","guid":{"rendered":"http:\/\/teske.dk\/?p=95"},"modified":"2012-02-16T14:48:59","modified_gmt":"2012-02-16T13:48:59","slug":"lntext","status":"publish","type":"post","link":"http:\/\/teske.dk\/?p=95","title":{"rendered":"LNText"},"content":{"rendered":"<p>My favorite tool is LNText. Don know if i can call it a tool though !<br \/>\nIt&#8217;s a script Library I use almost every where i code something in Lotus Notes. Why do i use it all the time? Maybe you have heard of it before, so its not a thing that i have invented, and you can find it different places on the Internet.<\/p>\n<p>It does the same as array, but its just a lot easier, because you don&#8217;t have to care about redim etc.<\/p>\n<p>Let med give you an example.<\/p>\n<p>If you have a multi value field, you can put it in to a LNText, and then I can use the LNText to check, modify, alter etc.<\/p>\n<p>This is how I do it.<\/p>\n<p>Option Declare<\/p>\n<p>Dim mvField as New LNText()<br \/>\n&#8230;set doc<br \/>\ncall mvField.setValue(doc.getItemValue(&#8220;mvField&#8221;))<\/p>\n<p>There can be 1,2 or a 100 entries in the mvField, but that doesn&#8217;t matter, LNText takes care of if.<\/p>\n<p>So if I want to print the entries out<\/p>\n<p>Dim i as integer<br \/>\nFor i=1 to mvField.getCount()<br \/>\n\tmsgbox mvfield.getElement(i)<br \/>\nNext i<\/p>\n<p>By the way &#8211; Always use doc.getItemValue(&#8220;FieldName&#8221;)(0) and not doc.FieldName(0).<\/p>\n<p>getItemValue always returns something, even if the field doesn&#8217;t exits, as doc.FieldName(0) returns an error if it doesn&#8217;t exits.<\/p>\n<p>But be aware &#8211; in Lotus Notes java code, it doesn&#8217;t do that any more. Previously all the core Notes classes behaved the same, but with this function it doesn&#8217;t. I&#8217;ll properly blog about that some time, and for now you can read about it in the help database. So be aware when you upgrade.<\/p>\n<p>And if I want to change a single value of the mulit value field. I can do this.<\/p>\n<p>Option Declare<br \/>\nDim mvField as New LNText()<br \/>\nDim i as integer<br \/>\n&#8230;set doc<br \/>\ncall mvField.setValue(doc.getItemValue(&#8220;mvField&#8221;))<\/p>\n<p>For i=1 to mvField.getCount()<br \/>\nIf mvField.getElement(i) = &#8220;the value i want to find&#8221;<br \/>\ncall mvField.setElement(i) = &#8220;the new value&#8221;<br \/>\nEnd if<br \/>\nNext i<\/p>\n<p>call doc.replaceItemValue(&#8220;mvField&#8221;, mvField.getValue)<\/p>\n<p>I this ex i have loaded the multivalue field into a LNText, ran through it, changed a value, and written it back to the doc. Very simple, and for me thats the easies way to do it.<br \/>\nAnd if you want to put an extra value to it, you can just use.<\/p>\n<p>call mvField.append(&#8220;extra value&#8221;)<br \/>\ncall doc.replaceItemValue(&#8220;mvField&#8221;, mvField.getValue)<\/p>\n<p>No redim, no nothing, just one line<\/p>\n<p>I have used a long time, so I know all the functions by heart. Read through all the functions, and see what it can do.<\/p>\n<p>And I&#8217;m sure you will learn to love the features of LNText()<\/p>\n<p>I also have a Java version of it, that behaves the same way. You can find them both on my resources page.<\/p>\n<p>Enjoy<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My favorite tool is LNText. Don know if i can call it a tool though ! It&#8217;s a script Library I use almost every where i code something in Lotus Notes. Why do i use it all the time? Maybe &hellip; <a href=\"http:\/\/teske.dk\/?p=95\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[74],"tags":[24,4],"_links":{"self":[{"href":"http:\/\/teske.dk\/index.php?rest_route=\/wp\/v2\/posts\/95"}],"collection":[{"href":"http:\/\/teske.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/teske.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/teske.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/teske.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=95"}],"version-history":[{"count":5,"href":"http:\/\/teske.dk\/index.php?rest_route=\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":100,"href":"http:\/\/teske.dk\/index.php?rest_route=\/wp\/v2\/posts\/95\/revisions\/100"}],"wp:attachment":[{"href":"http:\/\/teske.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/teske.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/teske.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}