Solved

Appending A Date to the end of a number

Posted on 2003-10-23
6
191 Views
Last Modified: 2013-12-18
Hi its me again - here is what I have

Sub Querysave(Source As Notesuidocument, Continue As Variant)
      Dim ws As New NotesUIWorkspace
      Dim s As New NotesSession
      Dim uidoc As NotesUIDocument
      Dim db As NotesDatabase
      Dim doc As NotesDocument
      Dim collection As NotesDocumentCollection
      Dim dateTime As New NotesDateTime("01/01/2000")
      Dim values() As Double
      
      If Source.FieldGetText("Status") = "Submitted" Then
            If Source.FieldGetText("LexECRNum") = "" Then        
                  Set db = s.CurrentDatabase
                  Set collection = db.Search("Form = ""ECRNumber""", dateTime, 0)
                  Set doc = collection.GetFirstDocument
                  value = doc.GetItemValue("ECRNumberCounter")
                  ecrNum% = Cint(value(0))
                  Call Source.FieldSetText("LexECRNum", Cstr(ecrNum%))
                  ecrNum% = ecrNum% + 1
                  Call doc.ReplaceItemValue("ECRNumberCounter",  ecrNum%)
                  Call doc.Save(True, False)
            End If          
      End If
End Sub

Basically when the form is submitted and saved a number is place in a field on the form - there is a seperate form that keeps the next number ready. so the field on the main form is computed with the next number - keeps the request in order.  

Right now it displays a number example (34) in a computed text field - Is there a way to append todays date on the end??

34 - 10/23/03
0
Comment
Question by:Jaziar
  • 4
  • 2
6 Comments
 
LVL 14

Expert Comment

by:p_partha
ID: 9607375
somethign liek this:
Sub Querysave(Source As Notesuidocument, Continue As Variant)
    Dim ws As New NotesUIWorkspace
    Dim s As New NotesSession
    Dim uidoc As NotesUIDocument
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Dim collection As NotesDocumentCollection
    Dim dateTime As New NotesDateTime("01/01/2000")
    Dim values() As Double
   
     If Source.FieldGetText("Status") = "Submitted" Then
         If Source.FieldGetText("LexECRNum") = "" Then        
              Set db = s.CurrentDatabase
              Set collection = db.Search("Form = ""ECRNumber""", dateTime, 0)
              Set doc = collection.GetFirstDocument
              value = doc.GetItemValue("ECRNumberCounter")
              ecrNum% = Cint(value(0))
              Call Source.FieldSetText("LexECRNum", Cstr(ecrNum%) &  cstr(Today))
              ecrNum% = ecrNum% + 1
              Call doc.ReplaceItemValue("ECRNumberCounter",  ecrNum% )
              Call doc.Save(True, False)
         End If          
    End If
End Sub

Partha
0
 

Author Comment

by:Jaziar
ID: 9607834
That is great! any way to put a dash between the number and month

right now it looks like this

5810/23/2003

would like

58 - 10/23/2003
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9608108
Dim ws As New NotesUIWorkspace
   Dim s As New NotesSession
   Dim uidoc As NotesUIDocument
   Dim db As NotesDatabase
   Dim doc As NotesDocument
   Dim collection As NotesDocumentCollection
   Dim dateTime As New NotesDateTime("01/01/2000")
   Dim values() As Double
   
    If Source.FieldGetText("Status") = "Submitted" Then
        If Source.FieldGetText("LexECRNum") = "" Then        
             Set db = s.CurrentDatabase
             Set collection = db.Search("Form = ""ECRNumber""", dateTime, 0)
             Set doc = collection.GetFirstDocument
             value = doc.GetItemValue("ECRNumberCounter")
             ecrNum% = Cint(value(0))
             Call Source.FieldSetText("LexECRNum", Cstr(ecrNum%) & " -  "  cstr(Today))
             ecrNum% = ecrNum% + 1
             Call doc.ReplaceItemValue("ECRNumberCounter",  ecrNum% )
             Call doc.Save(True, False)
        End If          
   End If


Partha
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 14

Accepted Solution

by:
p_partha earned 250 total points
ID: 9608110
oops typo .. use this

Dim ws As New NotesUIWorkspace
   Dim s As New NotesSession
   Dim uidoc As NotesUIDocument
   Dim db As NotesDatabase
   Dim doc As NotesDocument
   Dim collection As NotesDocumentCollection
   Dim dateTime As New NotesDateTime("01/01/2000")
   Dim values() As Double
   
    If Source.FieldGetText("Status") = "Submitted" Then
        If Source.FieldGetText("LexECRNum") = "" Then        
             Set db = s.CurrentDatabase
             Set collection = db.Search("Form = ""ECRNumber""", dateTime, 0)
             Set doc = collection.GetFirstDocument
             value = doc.GetItemValue("ECRNumberCounter")
             ecrNum% = Cint(value(0))
             Call Source.FieldSetText("LexECRNum", Cstr(ecrNum%) & " - " &  cstr(Today))
             ecrNum% = ecrNum% + 1
             Call doc.ReplaceItemValue("ECRNumberCounter",  ecrNum% )
             Call doc.Save(True, False)
        End If          
   End If
0
 

Author Comment

by:Jaziar
ID: 9608127
That is nice - Thanks
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9608139
Jaziar,
Thx for the points

Partha
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

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
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

895 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

13 Experts available now in Live!

Get 1:1 Help Now