Question : Lotus Script for Date Calculation in View Selection

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...
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
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 Select All

Answer : Lotus Script for Date Calculation in View Selection

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
Random Solutions  
 
programming4us programming4us