Tag: Notes formuletaal

  • Aantal dagen in een bepaalde periode met LotusScript

    Voor een applicatie moest herhaaldelijk uitgerekend worden hoeveel dagen er in een bepaalde periode zitten.
    De volgende functie voldeed hier goed:

    Input: getDaysBetween(“31-12-2007″,”01-01-2007”, “1,7” ,”25/12/07 – 26/12/07,05-12-2007″,Doc)  

    Output: 258

    Function getDaysBetween(strStart As String, strEnd As String,daysToExclude As String , datesToExclude As String ,Doc As NotesDocument) As Long
    On Error GoTo ErrorHandler
    Dim Formula As Variant
    Dim dLow As String
    Dim dHigh As String

    If strStart = “” Or strEnd = “” Then GoTo ErrorHandler

    strStart = {@TextToTime(“} & strStart & {“)}
    strEnd= {@TextToTime(“} & strEnd & {“)}

    If daysToExclude = “” Then
    dLow = {;0}
    Else
    dLow = {;@TextToNumber(@Explode(“} & daysToExclude & {“;”,”))}
    End If

    If Not datesToExclude = “” Then
    dLow = dLow & {;@TextToTime(@Explode(@TextToTime(@Explode(“} & datesToExclude & {“;”,”))))}
    End If

    dHigh$ = {@BusinessDays(} & strStart$ & {;} & strEnd$ & dLow & {)}
    dLow$ = {-@BusinessDays(} & strEnd$ & {;} & strStart$ & dLow & {)}

    Formula = Evaluate({@If(} & strStart & {>} & strEnd & {;} & dLow$ & {;} & dHigh$ & {)} ,Doc)

    getDaysBetween = CLng(Formula(0))

    Exit Function
    ErrorHandler:
    MsgBox GetThreadInfo(1) & ” ” & Error & ” (” & Err & “) op regel ” & Erl & “.”
    getDaysBetween = 0
    Exit Function
    Resume Next
    End Function

  • @LocationGetInfo

    Om informatie uit het huidige locatie document van de Notes Client op te halen kun je de formule @LocationGetInfo gebruiken.
    Als parameter geef je de veldnaam op die je wilt uitlezen.

    Enkele voorbeelden:

    @LocationGetInfo([FullName]) : Locatienaam
    @LocationGetInfo([MailServer]) : Homeserver
    @LocationGetInfo([InternetMailAddress]) : e-mail adres
    @LocationGetInfo([NamePreference]) : 0 voor standaard naam, 1 voor alternatieve naam
    @LocationGetInfo([BookmarksFilename]) : standaard bookmark.nsf
    @LocationGetInfo([SametimeServer]) : Sametime Server
    enz…

  • Aantal dagen in een maand

    Aantal dagen in een maand

    In een applicatie was het nodig om van een willekeurige maand het aantal dagen te kunnen tonen.
    Met de formule @BusinessDays( startDates ; endDates ; daysToExclude ; datesToExclude ) is dat goed mogelijk.
    Voor startDates kan simpelweg de eerste van de maand worden genomen, voor endDates zou je kunnen werken met @Adjust(@Adjust(startDates;0;1;0;0;0;0);0;0;-1;0;0;0) waarmee je dus eerst een maand optelt bij de startdatum en daarna een dag terug gaat.

    Voor LotusScript zou je de formule kunnen evalueren met de Evaluate functie.

  • LoadAddressListByIndex en LoadAddressListByName

    LoadAddressListByIndex en LoadAddressListByName zijn twee niet gedocumenteerde @formula commando in IBM Notes om namen uit een adresboek te tonen op het web:

    @DbCommand(“Domino”;[“LoadAddressListByIndex” | “LoadAddressListByName”];”names.nsf”; txtTargetField; strMax; [strIndex | strKey])