Solved

Appending A Date to the end of a number

Posted on 2003-10-23
6
193 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Work Space in Lotus Notes cannot found 6 170
Lotus notes error message 6 99
IBM Domino web server 5 66
Save conflict messages on existing documents 15 67
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…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

777 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