Solved

If..Then..Else Statements - Multiple statements

Posted on 2002-07-15
9
226 Views
Last Modified: 2013-12-18
I need to "enhance" the evaluation method used in setting the end result of a field.  The following script evaluates the rich text field to determine if there is an attachment (see below).  If there is an attachment, the status is changed to Status = "6 - Appraisal Completed" (and Statusflag5 = "1"); if the attachment is not found the Status = "5 - Management Review" (and Statusflag5 = "0").  

I need to keep the functionality already in place, plus add the following evaluation:

If field "Level" equals "Review" change Status to "5 - Management Review)(and Statusflag5 = "0").  
 
This step needs to be added to the current evaluation process that's already in the script.  (After the field "Level"is evaluated, the attachment field needs to be evaluated (same as current).





Function ValidateAppraisal_Report (Field As String) As Variant
    'Validation to find if there is atleast one attachment in this document
     Dim ws As New NotesUIWorkspace
     Dim uidoc As NotesUIDOcument
     Dim note As NotesDocument
     Dim rt As NotesRichTextItem
     
     Set uidoc = ws.CurrentDocument
     Set note = uidoc.Document
     AttachmentFound = False
     Call uidoc.Refresh(True)
     Set rt = note.GetFirstItem( Field )
    ' Check for attachments in the richtext item
     emobjs = rt.EmbeddedObjects
     If Isarray(emobjs) Then
          Forall emobj In emobjs
               If (emobj.Type=EMBED_ATTACHMENT) Then
                    AttachmentFound = True
               End If
          End Forall
     End If    
' Set the flags
     If AttachmentFound Then
          note.Status = "6 - Appraisal Completed"
          note.Statusflag5 = "1"
     Else
          note.Status = "5 - Management Review"
          note.Statusflag5 = "0"      
     End If
     Print "Attacment Found: " & AttachmentFound
     ValidateAppraisal_Report = AttachmentFound
End Function
0
Comment
Question by:mvm835
  • 5
  • 4
9 Comments
 
LVL 3

Expert Comment

by:Gunsen
ID: 7154330
Change the if statement (set the flags) to :
If AttachmentFound Or (note.Level(0) Like "Review") Then
0
 
LVL 10

Accepted Solution

by:
zvonko earned 150 total points
ID: 7154453
If I understood right, then it should be:
' Set the flags
    If AttachmentFound And (note.Level(0) <> "Review") Then
         note.Status = "6 - Appraisal Completed"
         note.Statusflag5 = "1"
    Else
         note.Status = "5 - Management Review"
         note.Statusflag5 = "0"      
    End If
    Print "Attacment Found: " & AttachmentFound
    ValidateAppraisal_Report = AttachmentFound
End Function

You see?

0
 
LVL 3

Expert Comment

by:Gunsen
ID: 7154775
I wherent able to repost my correction, but here it is zvonko :-)
If AttachmentFound And Not(note.Level(0) Like "Review") Then
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7154807
Do you know that Like operator is used for Regular Expressions?



0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Expert Comment

by:Gunsen
ID: 7154813
OptionCompare Text?
0
 
LVL 3

Expert Comment

by:Gunsen
ID: 7154822
You mean instead of "=" in LotusScript, no i didnt.
But syntatical it get more explicit reading using Like...
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7154826
That's the point: Like do not compare Text, it compare text against a pattern.

You use an exception that your pattern is the text itself, but be aware of special characters when used in pattern string.

0
 
LVL 3

Expert Comment

by:Gunsen
ID: 7154834
I thought it compared using Text (upper/lower/wild) comparison, provided using the option compare text..?
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7154865
As long as you do not use this chars: ?*#[]!
you get your readability by driving huge machine for simple compare.
Read here more:
http://doc.notes.net/domino_notes/5.0.3/help5_designer.nsf/078c27b23262ffff852566dd0029426a/4ade97d29a4ea80b8525687e0058971b?OpenDocument&AutoFramed

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Creating a new theme in discussion8.ntf 6 159
Lotus notes VB code 4 204
@ command if structure getting unmanageable 12 94
All incoming messages are coming as read 3 32
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…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

943 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now