Unifrax
asked on
Filtering Lotus Notes view by Month & Year
I will first explain the current database features I have in place.
The Database contains a form (frm_certreq) with a field (fld_compdate) which is filled in with the current date when a button is pressed, marking the document as completed.
The date output is in the format dd/mm/yyyy using the code -
I currently have a view (view_compdate) which lists all the completed documents. The first collumn showing the fld_compdate field (dd/mm/yyyy).
I wish to setup a way in which users can filter this view by month and year in order to have the ability to export monthly results for statistical purposes.
Any ideas or suggestions you have will be great in aiding my advancement with this database.
The Database contains a form (frm_certreq) with a field (fld_compdate) which is filled in with the current date when a button is pressed, marking the document as completed.
The date output is in the format dd/mm/yyyy using the code -
@SetField("fld_compdate";@Date(@Today));
I currently have a view (view_compdate) which lists all the completed documents. The first collumn showing the fld_compdate field (dd/mm/yyyy).
I wish to setup a way in which users can filter this view by month and year in order to have the ability to export monthly results for statistical purposes.
Any ideas or suggestions you have will be great in aiding my advancement with this database.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I could have sworn I saw an @Text(@Today) there... Ouch! My bad.
ASKER
Lars,
That's great in navigating by year and month. The only problem I have is that when I press the export to excel function
everything from the view is exported rather than a specific month.
That's great in navigating by year and month. The only problem I have is that when I press the export to excel function
Sub Click(Source As Button)
Dim ws As New notesuiworkspace
Dim uiview As NotesUIView
Set uiview = ws.CurrentView
Call ExportNotesView (uiview.ViewName, False)
End Sub
everything from the view is exported rather than a specific month.
I suppose that's what ExportNotesView does: to export an entire view...
You have to modify its code, or add a new function. Is the current code yours? Are you willing to share?
Or can you explain what behaviour you want, for there may be other ways to achieve it.
You have to modify its code, or add a new function. Is the current code yours? Are you willing to share?
Or can you explain what behaviour you want, for there may be other ways to achieve it.
ASKER
Yes, the codes mine, no problems with sharing.
The document is marked as complete which then sets a field to the current date.
My view has a few columns with different information from the document.
I need to export the content of this view but only for a specific month
The document is marked as complete which then sets a field to the current date.
@SetField("fld_compdate";@Date(@Today));
My view has a few columns with different information from the document.
I need to export the content of this view but only for a specific month
How do you want the user to indicate which month is to be exported? The view on your screen may be reduced to a specific month, but the Notes view itself doesn't change, only the presentation changes. The code of ExportNotesView should therefore be told what documents to select, by year and month.
ASKER
Ahh right.
Is there a way that when the button to export the document is pressed it requests the input of a month and year from the user in order to know what to export?
or maybe setup a way in which that the users could set a 'from' and 'up until' date that the code will check before exporting.
Is there a way that when the button to export the document is pressed it requests the input of a month and year from the user in order to know what to export?
or maybe setup a way in which that the users could set a 'from' and 'up until' date that the code will check before exporting.
There are several ways to get additional input from the user:
- the InputBox function
- NotesUIWorkspace.Prompt
- you can present your own dialog form using NotesUIWorkspace.DialogBox
- you can ask the user to select documents in the view (but that will be rather error prone, a mistake is easily made)
I suppose that, using the Prompt method I mentioned above, you could present a list of years and months, and ask the user to select one (PROMPT_OKCANCELLIST) or maybe even multiple months (PROMPT_OKCANCELLISTMULT). The code should, once the view is opened, select documents for those periods and export them.
- the InputBox function
- NotesUIWorkspace.Prompt
- you can present your own dialog form using NotesUIWorkspace.DialogBox
- you can ask the user to select documents in the view (but that will be rather error prone, a mistake is easily made)
I suppose that, using the Prompt method I mentioned above, you could present a list of years and months, and ask the user to select one (PROMPT_OKCANCELLIST) or maybe even multiple months (PROMPT_OKCANCELLISTMULT).
ASKER
Would you elaborate somewhat more on the Prompt method?
Where do i put the code?
What is the est of the code needed
A possible example?
I am only a novice in lotus notes programming.
Where do i put the code?
What is the est of the code needed
A possible example?
I am only a novice in lotus notes programming.
The Prompt method is a method of the NotesUIWorkspace class. It is fully documented in the Domino Designer Help database, please look it up in there... A quick link to that database somewhere on the net, with some examples that you'll find in the database as well:
http://notes.helsinki.fi/help/help8_designer.nsf/f4b82fbb75e942a6852566ac0037f284/fef765bb5901d63c8525731b004a7af8?OpenDocument
You'd have to extend the functionality of the ExportNotesView function you use. Or copy it into a new function, with additional parameters that indicate the months to be exported.
You'd have to do much of the coding yourself, I'm afraid, but there's a bright side: when the job is done you won't be a novice notes programmer anymore! Of course, when you have questions, you can always come back, e.g. if you need suggestions on how to adapt ExportNotesView (but you'd have to present its code).
http://notes.helsinki.fi/help/help8_designer.nsf/f4b82fbb75e942a6852566ac0037f284/fef765bb5901d63c8525731b004a7af8?OpenDocument
You'd have to extend the functionality of the ExportNotesView function you use. Or copy it into a new function, with additional parameters that indicate the months to be exported.
You'd have to do much of the coding yourself, I'm afraid, but there's a bright side: when the job is done you won't be a novice notes programmer anymore! Of course, when you have questions, you can always come back, e.g. if you need suggestions on how to adapt ExportNotesView (but you'd have to present its code).
And, given your original question, may I suggest opening a new question for handling the Excel export?
Now to the formula: you can use @TextToTme, e.g. like this:
dt:= @TextToTime(fld_compdate);
m:= @Month(dt);
y:= @Year(dt);
y
In your view, you can have two (new) categorized columns. The leftmost should have the above formula code to display the year, the second one the month (that formula should be easy).