Search DominoPower's 11,416 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Creating dynamic reports for the Notes client that go beyond embedded views (continued)

Next you need to grab a handle to your Folder and clear out the previous search information before beginning new report filtering.

Set uidoc = ws.CurrentDocument
Set fview = db.GetView ("BR") 'BR is the alias of the folder
Set doc = fview.GetFirstDocument
Do Until doc Is Nothing
Call doc.RemoveFromFolder("BR")
Set doc = fview.GetFirstDocument
Loop

Next you can set up variables for the criteria fields and determine if required fields have been filled in.

status = uidoc.FieldGetText ("Status")
If status = "" Then
Msgbox "You must enter the status", 16, "Input Error"
End
End If
dept = uidoc.FieldGetText ("Dept")
vwBy = uidoc.FieldGetText ("Vwby")

Now set up your query for the search.

'We are allowing the dept field to be left blank, in case the user wants to see all departments.
If dept = "" Then
qry = "FIELD Form = Transaction AND FIELD Status = " & status
Else
qry = "FIELD Form = Transaction AND FIELD Status = " & status & " AND FIELD Dept = " & dept
End If

Now you want to set up a minimum search date and a maximum search date based upon Monthly, Quarterly or the specified date range. In my date range example, if the user leaves the starting date empty, then the search will grab anything before the supplied ending date, and vice versa if he or she leaves the ending date empty. The search will grab anything after the supplied beginning date. If both fields are empty, the search grabs all dates. You won't need to worry about the empty fields at this point. You'll be taking care of that in the next step.

'Determine the dates to search on based on Monthly, Quarterly, or date range
Select Case vwBy
Case "Date Range"
Set minDate = New NotesDateTime ( uidoc.FieldGetText ("DateMin"))
Set maxDate = New NotesDateTime (uidoc.FieldGetText ("DateMax"))
Case "Monthly"
value = uidoc.FieldGetText ("MthYr")
If value = "" Then
Msgbox "You must enter the month and year you wish to view", 16, "Input Error"
End
End If
mth = Left (value, 2)
yr = Right (value, 4)

'In real life you would want to take into consideration leap years, but here we are just ignoring that.
Select Case mth
Case "01" : dy = "31"
Case "02" : dy = "28"
Case "03" : dy = "31"
Case "04" : dy = "30"
Case "05" : dy = "31"
Case "06" : dy = "30"
Case "07" : dy = "31"
Case "08" : dy = "31"
Case "09" : dy = "30"
Case "10" : dy = "31"
Case "11" : dy = "30"
Case "12" : dy = "31"
Case Else
Msgbox "The format of the month and year is incorrect. Please enter as mm/yyyy", 16, "Input Error"
End
End Select
Set minDate = New NotesDateTime (mth & "/1/" & yr)
Set maxDate = New NotesDateTime (mth & "/" & dy & "/" & yr)
Case "Quarterly"
'Code here would be similar to Monthly, only you will want to plug in the beginning and ending dates for each quarter
End Select


« Previous  ·  1  ·  2  ·  3  ·  4  ·  Next »
Other articles you might like
Home > Lotus Technologies > LotusScript (64 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Little known traps about Lotus Notes fields
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Five trends for 2010
Latest Lotus Headlines
More XPages onclick event weirdness...
Domino 8.5.1 Fix Pack 1 Interim Fix 1 (8.5.1 FP1 IF1) - DAOS Fixes
Domino Designer 8.5 Tip: Where Working Sets Are Stored
Invitation: LTIE Community Meeting - Tuesday, March 23rd 10AM ET
Flex: Using A SharedObject to Remember User Settings
Copy file instead of a link with Quickr connector in Notes
EclipseSource to Participate in Eclipse Foundation's Eclipse Training Series
>> Read all the news
More from the ZATZ journals
Computing Unplugged: Make Mafia Wars an offer it can't refuse
David Gewirtz Online: CNN commentary and analysis
OutlookPower: Removing an Office installation that doesn't want to go away
-- Advertisement --

Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done. Native to Lotus Domino. The User Experience unseen for Lotus Domino. Do more with less. Really.

See the possibilities Docova unleashes for Lotus Domino.
-- Advertisement --

Integrate your Notes Applications with Microsoft Office and Symphony
Integra for Notes Integrates Microsoft Office and/or IBM Lotus Symphony
Requires NO change to the design of the appliation or Installations of DLL's and EXE's
  • Integra is a ready to use solution, enhance static reports with Excel data analysis, pivot tables, macros
  • User friendly aproach, using a point and click access to features
  • Reports from any Lotus Notes databases
  • Runs reports through a Notes client, web browser and scheduled basis
  • Allows use of LotusScript for advanced data manipulation
  • Enables self service reporting capabilities to end-users


Learn more at www.integra4notes.com.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login