Solved

Indicate date that field changed to a specific value?

Posted on 2003-11-20
8
318 Views
Last Modified: 2013-12-18
I am looking to find out how to indicate the date that a field was saved with a specific value.

I am wanting to do this with a calltrack form I am working on.  The form will have two status indicators in a "Status" field: either "Open" or "Closed".  The Date Open field is easy, just indicating the date that the form was created.  But as far as Date Closed, I need to find a way to populate this field with the date of the last Save when the Status field indicated "Closed".

Any ideas?
0
Comment
Question by:brianbailey
  • 3
  • 3
  • 2
8 Comments
 
LVL 2

Expert Comment

by:ksi2001
ID: 9789797
Form Declarations

Dim  Status As String

QueryOpen

Status=source.FieldGetText("Status")

QuerySave

If Status<>"Closed" And source.GetFieldText("Status")="Closed then
   Call source.FieldSetText("DateClosed",Now)
End If



0
 
LVL 2

Expert Comment

by:ksi2001
ID: 9789806
correction:

If Status<>"Closed" And source.FieldGetText("Status")="Closed then

0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9789874
Declare a global variable say LastStatus as string

Now in Post open record the values like this

If Not Source.IsNewDoc then
LastStatus = Source.Document.Status(0)
End if

In the QuerySave

If LastStatus <> Source.Document.Status(0) then
 Source.Document.ClosedAt = Now    ' This is the time when close status was saved
End if


~Hemanth
0
 

Author Comment

by:brianbailey
ID: 9790552
Okay...

I am not as familiar with Lotus Notes as you all are.  I'm not exactly sure what you mean by the following:

Form Declarations
Dim
QueryOpen/Save
Post

It is notes version 4.6 (ancient).  If you can explain to me what to do as if you were explaining it to someone who doesn't really know coding too well, I would gladly appreciate it.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 24

Assisted Solution

by:HemanthaKumar
HemanthaKumar earned 250 total points
ID: 9790619
Open the form in design mode.. by choosing menu View..Design

This will open a raw design of the db. Now choose Forms.. This section contains list of forms used in the db.

Select the form which you want to make changes to and double click on it open it in design mode

When you open the form, it will expose fields and script events.. Program pane shows the events. When you select Globals (denoted as (Global))and paste this

Dim lastStatus as String

Now click on the form name denotes as (Form)
This will expose PostOpen and QuerySave events

Select the postopen event and paste this script

If Not Source.IsNewDoc then
LastStatus = Source.Document.Status(0)
End if

Similarly , select In the QuerySave event paste this

If LastStatus <> Source.Document.Status(0) then
 Source.Document.ClosedAt = Now    ' This is the time when close status was saved
End if

Now save the form and test it.

0
 

Author Comment

by:brianbailey
ID: 9791305
Ok HemanthaKumar,

I set it up just like you said.  Created one where status was open and one where status was closed.  No matter what status i saved it as, the current date populated in the Date Closed field (which is an improvement, I admit).  What am I doing wrong?
0
 
LVL 2

Accepted Solution

by:
ksi2001 earned 250 total points
ID: 9791467
here is a combination of mine and Hemantha's code which should work correctly:


leave declaration and postopen as Hemantha said

for the querysave event:

newStatus=Source.Document.Status(0)

If LastStatus <> newStatus and newStatus="Closed" then
   Source.Document.ClosedAt = Now    
End if




0
 

Author Comment

by:brianbailey
ID: 9791523
It works!

You guys rock!  I hope I did the points right.  Let me know if you didn't get them.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 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

10 Experts available now in Live!

Get 1:1 Help Now