Solved

Appending A Date to the end of a number

Posted on 2003-10-23
6
196 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 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