Solved

Triggers a notification if TotalDays is ..

Posted on 2004-04-11
20
287 Views
Last Modified: 2013-12-18
hi Experts

I have a form called Employee with the following fields.

Empno      Text
Name      Text
HireDate      Date/Time
TotalDays      Number      Computed
            Due:=@Abs(@Integer((HireDate -ToDate) / (60 * 60 * 24)));
            @If(HireDate="";0;Due)

I have created some documents and TotalDays works fine. Returns 1 if HireDate is 04/10/2004

I've created a view for Employee form. View is called Employee View | EMPV.

In the view, I've created columns for all the 4 fields. If I create a document, the view displays Empno, Name, HireDate but does not display the TotalDays. I struggled for a long time but couldn't get the solution. :(

Actually I need this view when an employee completes 1 month. Means when 30 appears in the TotalDays of the view, an agent triggers a notification to someone.

Or anyone has any other way to send a notification if the totaldays is 30. ??
0
Comment
Question by:ninteen83
  • 7
  • 7
  • 4
  • +2
20 Comments
 
LVL 15

Expert Comment

by:Bozzie4
ID: 10800373
What is ToDate ?

I don't understand what you are doing : is TotalDays a fixed number, or is it meant to change every day ('countdown') ?

Tom
0
 

Author Comment

by:ninteen83
ID: 10800388
ToDate   is   Date/Time,   Computed,   @Today
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10800443
If you check the Document Properties, is the correct value for TotalDays in the Document? Do you have validation checks in the date fields, using @IsTime()?
0
 

Author Comment

by:ninteen83
ID: 10800460
Sorry Dear .. I didn't get your 1st point. I'm not using any validation in the date fields. TotalDays returns number and everyday it changes because of ToDate. In all the documents it works/appears but it does not appear in the view.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10800774
Eh? "... everyday it (TotalDays) changes ..."? Documents don't change by themselves. Only a person, either directly or by means of an agent, can change a document. Storing TotalDays is therefore more or less pointless, just like ToDate for it will contain the date when the document is last saved.

In the view, the number of days should be recomputed every time the view is reopened. This makes it a time-consuming view. You might better store the date of the next milestone in the document, and make a view sorted ascending on the milestone date. You can make an agent that walks through the first few documents of that view every day. The documents with a milestone that lies today or before today should be dealt with, and they should be given a new milestone date. The others will be handled automatically the next day.

About my first point: open the view with the documents, DON'T open the document but type Alt-Enter (or click File/Document Properties), the Properties box will open, go to the second tab, and find the TotalDays item there. At the right you can find its value. What is it?
0
 
LVL 14

Expert Comment

by:p_partha
ID: 10801623
When you open the document, do u see the value in TotalDays. If yes then you should be seeing the value in view also. Also, if you want u can store the 30 days from the HIREdate in one field when the document is created and check ur agent against this date, so that u can minimize the calcualtion

Hope i am clear here

Partha
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10802210
Use your formula in the TotalDays with little modification the TotalDays column

          @If(HireDate="";0; @Abs(@Integer((HireDate -@Today) / (60 * 60 * 24))) )

~Hemanth

 
0
 

Author Comment

by:ninteen83
ID: 10803596
sjef bosman

I have gone through the Document Properties from the view. All Fields are there except TotalDays .. :( yes TotalDays doesn't appear in the Document Properties if I open it from the view ..
0
 

Author Comment

by:ninteen83
ID: 10803667
p partha

it doesn't appear in the view at all .. you can check it from the following link

http://members.fortunecity.com/nadirshah/img2/notes.gif
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10804103
If, as you say, TotalDays is NOT in the Document Properties as a field, AND the field appears in the form, AND it is really the same form you are using, then the field MUST be on the form as Computed for Display.

What about my other suggestion, did you try that?? The milestone-date stuff?

I checked the link, there's nothing there except for a nice gif. You have a more interesting URL? ;)

Sjef
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 15

Accepted Solution

by:
Bozzie4 earned 100 total points
ID: 10805557
Your design doesn't make much sense.  Like Sjef says, documents don't refresh themselves...

So change it.

Doing the calculations in the view is a possibilty, but very bad performance-wise.  Avoid all time functions in views, because they will cause the view to recalculate all the time (yes, also @today).

Make TotalDays an Computed When Composed field, and use an agent to compute the number of days left.  This will make your view much faster.  Add the same logic to the QuerySave event (or the QueryRecalc event), so when people change a document, the values change too.  

Agent :  schedule it daily, at 3 o'clock in the morning or something.  Use your formula:
SELECT form="YourFormHere";
FIELD TotalDays := @If(HireDate="";0; @Abs(@Integer((HireDate -@Today) / (60 * 60 * 24))) )

In the view, put TotalDays.

In the QuerySave, and QueryRecalc events, put the same formula, to update the documents whenever someone saves it.
FIELD TotalDays := @If(HireDate="";0; @Abs(@Integer((HireDate -@Today) / (60 * 60 * 24))) )

cheers,

Tom




0
 

Author Comment

by:ninteen83
ID: 10810808
Bozzie ! I have tried the exact what you suggested  .. but no luck :( .. TotalDays still doesn't appear in the view. I've changed TotalDays' type from Computed to Computed for Display, Computed when Composed even to Editable .. it works .. but doesn't appear in the view ...
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 10810894
When you change the type, you must run the agent to set the field values.  You can check if the TotalDays field is set, by using the Document Properties (ALT-Enter, and look to the field values).

cheers,

Tom
0
 

Author Comment

by:ninteen83
ID: 10811079
Now the totaldays is appearing in the view ..

Thanks Bozzie .. Thank you all guys ..
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10811707
As Tom said earlier, your design still doesn't make much sense. There are many roads from A to B, but you're taking a short-cut you'll be regretting some day. I think you "jumped to a solution" without analysing the requirements completely. The fact that you ignored my well-meant remarks is understandable but it indicates to me that you're not thinking ahead. You're solving your current problem without realizing that you created future issues.

If I'm way off, pray forgive me, but if you'd like to discuss this further I'm happy to do so.

Sjef :)
0
 

Author Comment

by:ninteen83
ID: 10819926
SJef !

I was looking for a quick and easy solution. Ofcourse my design still doesn't make sense. A document doesn't change by itself. I really appreciate your efforts to solve this problem.

The problem is that I'm new to Lotus Notes therefore I couldn't get what was suggested by you. :O and I couldn't ask you to describe it step by step. :'(


Sincerely.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10821143
ninteen83,

> and I couldn't ask you to describe it step by step

Why not? Just the fact that you're new to Notes should be the most important motive to ask almost anything! That is, if you intend to learn a lot. You know these sayings:
1. "There are no stupid questions, only stupid answers"
2. "There's never time to do it right, but there is always time to do it over".

Do think of your design in you spare time, and don't hesitate to ask questions!

Sjef :)
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10821172
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 10822984
"There are no stupid questions, only stupid people" :-)

Tom
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10823363
LOL
0

Featured Post

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!

Join & Write a Comment

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise 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…
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

705 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

16 Experts available now in Live!

Get 1:1 Help Now