Solved

Appending A Date to the end of a number

Posted on 2003-10-23
6
190 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 14

Accepted Solution

by:
p_partha earned 250 total points
Comment Utility
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
Comment Utility
That is nice - Thanks
0
 
LVL 14

Expert Comment

by:p_partha
Comment Utility
Jaziar,
Thx for the points

Partha
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

12 Experts available now in Live!

Get 1:1 Help Now