Solved

Appending A Date to the end of a number

Posted on 2003-10-23
6
198 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

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…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

763 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