Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I write @Command([FileExport] in Lotus Script?

884 views
Skip to first unread message

Lee

unread,
Mar 6, 1998, 3:00:00 AM3/6/98
to

Hi,

Can someone please tell me the commands involved in converting a
FileExport for a view to Lotusscript. I need the view to be saved by a
scheduled agent so I can't just use @Commands as the view will not be
current when the agent is running.

Any help would be greatly appreciated.

Thanks,

Lee.


Rob Appel

unread,
Mar 6, 1998, 3:00:00 AM3/6/98
to

Hiya,

Here's some sample code. There are several ways for this. This one doesn't
take the values from the view: it takes them from the document. I have also
one which gets the values from the view: He looks at the header title and
thinks this is the fieldname. I don't have on which really evaluates the
formula in the column itself.

What this code does is save the documents to a comma seperated list.

Please note that you have to allow yourself to run unrestricted agents on
the server!


Dim db As notesdatabase
Dim ses As New notessession
Dim col As notesview
Dim doc As NotesDocument
Dim fileNum As Integer

' Only continue if the user knows what he's doing
Drive="c:\"
Filename="person.csv"
If Messagebox("Stop een diskette waarop de personeelslijst moet komen
te staan in drive "+drive+" en druk op Ok. De personeelslijst wordt
opgeslagen onder de naam "+filename, MB_OKCANCEL,"Personeelslijst") =
IDCANCEL Then Exit Sub

' get a file number for the file
fileNum = Freefile
' open the file for writing
Open drive+filename For Output As fileNum

Set db = ses.currentdatabase
Set col = db.getview("vwAchternaam")


Print #filenum,
"""Personeelsnr"",""Achternaam"",""Voorletters"",""Voorvoegsels""," +_
"""Meisjesnaam"",""Voornaam"",""Aanspreektitels"",""Dhr/Mevr""," + _
"""Geb. datum"",""Formatienr"",""Functie"",""Commissies""," + _
"""Datim in dienst"",""Datum dienstverband"",""Dienstverband""," + _
"""Datum uit dienst"",""Reden"",""Persoonlijke schaal"",""Formatie
schaal""," + _

"""Formatie-uren"",""Anciëniteit"",""Bezettingsuren"",""fte"",""Feitelijke
bezetting""," + _
"""Restant"",""Hoofdlokatie"",""Kamer"",""Afdeling"",""Onderdeel""," +
_
"""Lotus e-mail"",""Telefoon"",""Toestel"",""Fax"",""Mobiel""," + _

"""Sublokatie"",""Kamer"",""Afdeling"",""Onderdeel"",""Telefoon"",""Toestel"
",""Fax""," + _
"""Privé straat"",""Huisnr"",""Postcode"",""laats"",""Telefoon
privé"",""Mobielnr"",""Fax"",""e-mail"""

n=1
While True

Set doc = col.getnthdocument(n)
If doc Is Nothing Then Goto TheEnd

Dim dhrmevr As String
If doc.dhr_mevr(0)="1" Then dhrmevr="H" Else dhrmevr="D"
Dim commissies As Variant
commissies = Evaluate("@implode(commissies;', ')",doc)

cLine1= Format(doc.personeelsnummer(0))+","""+ _
doc.achternaam(0)+""","""+ _
doc.voorletters(0)+""","""+ _
doc.voorvoegsels(0)+""","""+ _
doc.meisjesnaam(0)+""","""+ _
doc.voornaam(0)+""","""+ _
doc.aanspreektitels(0)+""","""+ _
dhrmevr+""","

cLine2=FormatDate(doc.geboortedatum(0))+ ","""+ _
Format(doc.formatienummer(0))+""","""+ _
doc.functie(0)+""","""+ _
commissies(0)+""","+ _
FormatDate(doc.datumindienst(0))+","+ _
FormatDate(doc.datumdienstverband(0)) +","""+ _
doc.dienstverband(0)+"""," + _
FormatDate(doc.datumuitdienst(0))+ ","""+ _
doc.redenuitdienst(0)+""","

cLine3=FormatNumber(doc.persoonlijkeschaal(0))+"," + _

FormatNumber(doc.formatieschaal(0))+"," + _
FormatNumber(doc.formatieuren(0))+"," + _
FormatDate(doc.datumancieniteit(0))+"," + _
FormatNumber(doc.bezettingsuren(0))+"," + _
FormatNumber(doc.fte(0))+"," + _
FormatNumber(doc.FeitelijkeBezetting(0))+"," + _
FormatNumber(doc.restant(0))+","""

cLine4=doc.lokatie(0)+""",""" + _
doc.kamer(0)+""",""" + _
doc.afdeling(0)+""",""" + _
doc.onderdeel(0)+""",""" + _
doc.lotusemail(0)+""",""" + _
doc.telefoon(0)+""",""" + _
doc.extensie(0)+""",""" + _
doc.fax(0)+""","""

cLine5=doc.mobiel(0)+""",""" + _
doc.sublokatie(0)+""",""" + _
doc.subkamer(0)+""",""" + _
doc.subafdeling(0)+""",""" + _
doc.subonderdeel(0)+""",""" + _
doc.subtelefoon(0)+""",""" + _
doc.subextensie(0)+""",""" + _
doc.subfax(0)+""","""

cLine6= doc.pstraat(0)+""",""" + _
doc.pHuisnr(0)+""",""" + _
doc.pPostcode(0)+""",""" + _
doc.pWoonplaats(0)+""",""" + _
doc.pTelefoon(0)+""",""" + _
doc.pMobiel(0)+""",""" + _
doc.pFax(0)+""",""" + _
doc.peMail(0)+""""

Print #filenum, cLine1+cLine2+cLine3+cLine4+cLine5+cLine6
n=n+1
Print n
Wend

TheEnd:
' close the file
Close #fileNum
Messagebox Format(n-1)+" personeelsleden geëxporteerd naar
"+drive+filename


Lee <l...@designs.prestel.co.uk> wrote in article
<34FFD11F...@designs.prestel.co.uk>...

Lee

unread,
Mar 6, 1998, 3:00:00 AM3/6/98
to

Rob Appel wrote:

> Hiya,
>
> Here's some sample code. There are several ways for this. This one
> doesn't
> take the values from the view: it takes them from the document. I have
> also
> one which gets the values from the view: He looks at the header title
> and
> thinks this is the fieldname. I don't have on which really evaluates
> the
> formula in the column itself.
>
> What this code does is save the documents to a comma seperated list.
>
> Please note that you have to allow yourself to run unrestricted agents
> on
> the server!

> etc..

Thanks for your help, Rob. I managed to get it to do what I want using
the following, if anybody else is interested to know:

Sub Initialize
Dim session As New Notessession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim view As NotesView
Dim doc As NotesDocument
Set view = db.GetView("ViewName")
Set doc=view.GetFirstDocument
'Wanted it to go to a network drive, so used:
Drive="\\Rasserver\Upload\"
Filename="Sales.txt"
fileNum = 1


Open drive+filename For Output As fileNum

Set doc = view.GetFirstDocument

While Not(doc Is Nothing)
Print #filenum, doc.ExportString(0)
Set doc = view.GetNextDocument(doc)
Wend

Close #fileNum
End Sub


Thanks again,

Lee.


scott_sullivan

unread,
Mar 6, 1998, 3:00:00 AM3/6/98
to

Use the "Print#" statement to create a txt file.

In article , Lee says...


>
>Hi,
>
>Can someone please tell me the commands involved in converting a

Sonia Salon

unread,
Mar 20, 1998, 3:00:00 AM3/20/98
to

And how do the same thing, but to export the documents (all fields) even
the first image they contain ???
i'd want to export the content of documents (selectionned, or in a folder)
in word or publisher and each document contains an image.
i can export the image document by document by TIFF export and i can export
the text content by other export types (Word, ASCII, RTF,...), but i don't
know how export all in Lotus Script...


Thanks for help
Sonia

Lee <l...@designs.prestel.co.uk> a écrit dans l'article
<35002907...@designs.prestel.co.uk>...


> Rob Appel wrote:
>
> > Hiya,
> >
> > Here's some sample code. There are several ways for this. This one
> > doesn't
> > take the values from the view: it takes them from the document. I have
> > also
> > one which gets the values from the view: He looks at the header title
> > and
> > thinks this is the fieldname. I don't have on which really evaluates
> > the
> > formula in the column itself.
> >
> > What this code does is save the documents to a comma seperated list.
> >
> > Please note that you have to allow yourself to run unrestricted agents
> > on
> > the server!

> > etc..
>
> Thanks for your help, Rob. I managed to get it to do what I want using
> the following, if anybody else is interested to know:
>
> Sub Initialize
> Dim session As New Notessession
> Dim db As NotesDatabase
> Set db = session.CurrentDatabase
> Dim view As NotesView
> Dim doc As NotesDocument
> Set view = db.GetView("ViewName")
> Set doc=view.GetFirstDocument
> 'Wanted it to go to a network drive, so used:
> Drive="\\Rasserver\Upload\"
> Filename="Sales.txt"
> fileNum = 1

> Open drive+filename For Output As fileNum

0 new messages