?
Solved

Lotus Script Syntax question

Posted on 2011-10-31
9
Medium Priority
?
528 Views
Last Modified: 2013-12-18
I am exporting data from Notes to Excel. In the statement,

xlsheet.Cells(row%,14).Value=doc.SystemImpacted(0)

where SystemImpacted is the field name.  What does the (0) do?  The field is multi value and only one value is transferring, and I'm thinking that might be it.   Thanks in advance.  
0
Comment
Question by:jkee54
  • 4
  • 3
  • 2
9 Comments
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 1000 total points
ID: 37060148
That's definitely it. I'll explain the syntax the best I can:
- doc.SystemImpacted(0) is the shorthand equivalent of doc.GetItemValue("SystemImpacted")(0)
- the doc.GetItemValue method always returns an Array
- the (0) is actually an index in that array
- the 2nd element in the array (if any) would be doc.GetItemValue("SystemImpacted")(1)

It is multi-value, but where do you want those values to go, and how exactly? You can try at least in two ways:
- doc.GetItemValue("SystemImpacted").Text returns a string with values separated by semicolons
- Join(doc.GetItemValue("SystemImpacted"), ";") if you want more control overthe content of the string
0
 

Author Comment

by:jkee54
ID: 37060240
OK.  I tried

xlsheet.Cells(row%,14).Value=doc.GetItemValue("SystemImpacted").Text

and

xlsheet.Cells(row%,14).Value=doc.GetItemValue("SystemImpacted")(0)

The field is a checkbox with multiple values allowed.  It still only transfers one value when there are two chosen.   I don't think using (1) or (2) is good because there could be up to 8 values chosen.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 37060252
And

xlsheet.Cells(row%,14).Value= Join(doc.GetItemValue("SystemImpacted"), ";")
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 37060258
The first one was a mistake of mine, with the .Text property. Try this one:

xlsheet.Cells(row%,14).Value= doc.GetFirstItem("SystemImpacted").Text

A NotesItem has a Text property, see also
http://www-12.lotus.com/ldd/doc/lotusscript/lotusscript.nsf/1efb1287fc7c27388525642e0074f2b6/3ca13568d23f5b8d8525642e007702f9?OpenDocument
0
 

Author Comment

by:jkee54
ID: 37060310
xlsheet.Cells(row%,14).Value= Join(doc.GetItemValue("SystemImpacted"), ";")  
or
xlsheet.Cells(row%,14).Value= doc.GetFirstItem("SystemImpacted").Text

didn't work.  In the document properties, the two values are each included in quotes on separate lines with no separator other than a carraige return, yet only one shows up in Excel.  Allow multiple values is definitely checked.

Here's something interesting - when I do an export in 123 format, the two values in the selected record end up on row 2 and 3, separately, under the field header on row 1.  Is it the way the data is collecting?

0
 
LVL 11

Expert Comment

by:larsberntrop
ID: 37061356
Hey Sjef, it's LotusScript, not Java: the Array type is not an object with a .Text property or method...

@jkee54:
Try asssigning the value you get to a variable first, like:
Dim checks$

checks = doc.GetFirstItem("SystemImpacted").Text
or
checks = Join(doc.GetItemValue("SystemImpacted"), ";")

then assign that var to the excel cell:
xlsheet.Cells(row%,14).Value = checks
you can then print the value or check it using the LotusScript debugger.  Also, this forces the expression to that of type String, which might be handled differently by Excel ( the code which is handling calls to the xlsheet object)


Furthermore you need more developer knowledge.  you might start oyut by reading the developer Help, included with the Notes Designer client in the Help direcory.  I find that db still a very useful resource, even with 15 years of Notes programming experience. When you open it, look at the Contents, there should be a LotusScript Language main topic, just expand that and start reading.  The next main topic, LotusScript/COM/OLE Classes, is another important one.  Start by reading introductory parts of both topics, and try to look at most contents at least once (not ALL examples, and you dont need to learn the reference stuff by heart, but understanding the concepts, and having a general understanding of the availbale object classes and what they can do an what information they can provide is very useful information.

There are also great developer Redbooks available, for free! just go to http://www.redbooks.ibm.com/cgi-bin/searchsite.cgi?query=LotusScript


Have fun!
0
 
LVL 11

Expert Comment

by:larsberntrop
ID: 37061362
@Sjef disregard that first remark, error 40 on my part...
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 37061478
Next guess: there are carriage returns in the text field. @JKee, can you post an image of the Document Properties window only, of the SystemImpacted field, the right-hand side scrolled down a little bit so it shows parts of both the first and the second line? Does the first line end in a double-quote or not? If it does, it's a multi-value field, otherwise it's not and there must be CRs in the text.
0
 

Author Comment

by:jkee54
ID: 37085515
It worked with the
checks = doc.GetFirstItem("SystemImpacted").Text

code, but not until I closed the DB and waited a few minutes.

Thank you!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question