Solved

Lotus Script for Date Calculation in View Selection

Posted on 2009-05-11
10
1,162 Views
Last Modified: 2013-12-18
Hey Experts, Below I've posted a script I'm using on a view action that will allow the user to select a User and a job, it then modifies the view select formula to reflect the users picks, this is working fine, I need to enhance the script by allowing the user to also pick a date range and getting that into the Select formula: i.e. User selects John, then selects job 123 next should be a prompt for a begin date, then an end date with the end date defaulting to today. Once he has selected this the Select formula should reflect accordingly. Select Form = FormName & User ="John" & JobNumber = "123" & @Adjust (@Date (TimeinDate); 0; 0; -???; 0; 0; 0) = @Date (@Today);
The ??? should reflect the difference in the dates they have selected.....This is probably clear as mud but it's a start...
Modified Script: Allows for selection of Professional and Job Number:
Sub Click(Source As Button)
	Dim session As New NotesSession
	Dim db As NotesDatabase
	Set db = session.CurrentDatabase
	Dim ws As New NotesUIWorkspace	
	Dim UserDbColumn As Variant	
	Dim JobDbColumn As Variant
	UserDbColumn = Evaluate(|@Trim(@Unique(@DbColumn("";"":"";"(TimeByJobSel)";1)))|)	
	GetValue = ws.Prompt(4, "Professional", "Select Professional", "",UserDbColumn)
	If GetValue =  "" Then
		Messagebox "Operation Canceled" ,,"No Professional Selected."
		Exit Sub
	End If
	JobDbColumn = Evaluate(|@Trim(@Unique(@DbColumn("";"":"";"(TimeByJobSel)";2)))|)	
	GetValue1 = ws.Prompt(4, "Client Matter", "Select Job", "",JobDbColumn)
	If GetValue1 =  "" Then
		Messagebox "Operation Canceled" ,,"No Job Selected."
		Exit Sub
	End If
	Dim NewFormula As String
	NewFormula = |SELECT Form = "Timeslip" & From="|& GetValue & |" & JobNumber= "|& GetValue1 & |" |
	Set uiview = ws.CurrentView
	Set view = uiview.View
	view.SelectionFormula = NewFormula
	Call ws.ViewRebuild
	
End Sub

Open in new window

0
Comment
Question by:padillrr
  • 6
  • 4
10 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 24363010
Don't use Prompts, instead create a small form and use it in a dialog box.

And why do you modify a view's selection formula?? If it's a private view it won't disturb the others, but for a central view it's not very wise to do. Can't you use db.Search, or db.FtSearch, and a folder??
0
 

Author Comment

by:padillrr
ID: 24364876
The View is doing some calculations on a total, the requirement is to allow the user to select a time period, a person and a job when these are selected the view then displays a total amount of time that person has completed on that specific job. It has been working OK until I was asked to allow for some date ranges i.e. How much time does "Ray" have on job number "1234" from the "1st of May 2009" until "Today"? I tried creating a form but then my view scripts don't work on the embedded view.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 24365016
Why the embedded view? On the form? That's not what I meant. Create a form with a fixed-size table, put three fields on the form (JobNumber, From and To), show it using a ws.DialogBox(bla-dee-bla, ..., fittotable, tempdoc) and upon return of the call use the fields from tempdoc to update the view formula.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 

Author Comment

by:padillrr
ID: 24366979
Got the form done up getting the values I need now how do I pass them onto the Select formula???
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 250 total points
ID: 24370421
So you created a button or so, or an action, that calls the DialogBox, gets the values , etc. When the DialogBox returns, you have all the data in your calling button function, right?

All you need to do now is adapt the formula
              NewFormula = |SELECT Form = "Timeslip" & From="|& GetValue & |" & JobNumber= "|& GetValue1 & |" |
            If dbdoc.StartDate(0)!="" Then
                  NewFormula= NewFormula + | & StartDate>[| + Cstr(dbdoc.StartDate(0) + |]|
            End If
            If dbdoc.EndDate(0)!="" Then
                  NewFormula= NewFormula + | & StartDate<[| + Cstr(dbdoc.EndDate(0) + |]|
            End If
0
 

Author Comment

by:padillrr
ID: 24558536
Sorry project deviated for a while will be back on this on Monday...
0
 

Author Comment

by:padillrr
ID: 24584013
again put onsomething else....I will get to this please do not close!
0
 

Author Comment

by:padillrr
ID: 24659657
Sjef, I took this in a totally different route, look at this question, it will explain what I ended up doing instead.  http://www.experts-exchange.com/Software/Server_Software/Email_Servers/Lotus_Domino/Q_24476889.html

I will award the points for all your help, Thanks
0
 

Author Closing Comment

by:padillrr
ID: 31580366
Thanks Sjef, you always come through!
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 24660952
:-))
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

Suggested Solutions

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
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…

820 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