?
Solved

@Adjust Question

Posted on 2006-04-03
21
Medium Priority
?
312 Views
Last Modified: 2013-12-18
I am using the following selection formula in a view and I was wondering if it would be possible to have the number of days (-2) in the adjust formula extracted from a setup document thereby making it unnecessary to have to change it in the formula

startdate:=@Adjust(@Today;0;0;-2;0;0;0);
SELECT  (Form = "PC" | Form = "PCW") & @Created > startdate
0
Comment
Question by:witgrefe
  • 10
  • 7
  • 2
  • +2
21 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16360224
Is this for a personal view or for a shared view?

Could this be handled using an agent that selects the documents, puts them in a folder (personal or shared) and then switches to the folder?
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16360233
Hi witgrefe,
what is setup document?

If it's the profile doc then use:
    @GetProfileField( profilename ; fieldname )

If you have document's unid use:
    @GetDocField( documentUNID ; fieldName )

Hope this helps,
Marko
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16360265
Won't work in a view's SELECT statement. @Environment will work, but using it in a view is not good.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:mbonaci
ID: 16360309
sjef_bosman,
you're right, I didn't read carefully - "setup document" got all my attention.

Marko
0
 

Author Comment

by:witgrefe
ID: 16360762
The setup document is just a form where the user can set certain parameters, nothing special. I was hoping the value could be pulled from there and used in the selection formula
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16362199
Yes, it can be done, but Notes views aren't constructed for that kind of work. Views usually are pretty static things, they are constructed once, the SELECT is evaluated once (unless there's an @Today in it), in order to make them fast. So if you want to change the view's SELECT statement, you can use @Environment to get a parameter from the Notes.ini but you have to update the view's index afterwards. Furthermore, if other people use the same view, they use the same SELECT...
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16362730
Agreed,  But you can always have an agent run that selects the documents and puts them into a private folder for the viewer.  Each time it runs it removes the documents in the folder and adds the new ones, or you can prompt the user to see if they want to add to existing or remove existing.

This way you can also ask them how many days to search for, too.

0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16362786
Now where did I read that before... In a more concise version, of course ;)
0
 
LVL 14

Expert Comment

by:p_partha
ID: 16364050
Guys
How abt using Selectionformula method of notesview class and change it accordingly (R6 though !)

Example from help:

Dim ws As New NotesUIWorkspace
  Dim uiview As NotesUIView
  Dim view As NotesView
  Dim formula As String
  formula = "SELECT (@Modified > [" & (Date - 7) & "])"
  Set uiview = ws.CurrentView
  Set view = uiview.View
  view.SelectionFormula = formula


Partha
0
 

Author Comment

by:witgrefe
ID: 16368065
Hello All,
what I am doing is gathering statistics from a database that holds thousands of documents (trranslations) an agent purges documents when they are 60 days old.  The statistics will be automatically gathered daily by an agent that runs near to midnight when there is not too much activity.  It then creates a report.  The first thing it does is read the setup doc to establish location of databases and other information it needs.

Now, because there are tens of thousands documents, if I run the agent on them all it takes a long long time.  So I have created a hidden view for the agent to use in which I can select the number of days for the documents to be displayed and this is where I wanted to have it grab the parameter from a setup doc because I also use the number of days in the view in various calculations and that means that I have to hardcode the number of days into the agent instead of being able to pull it from my setup doc.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16368294
Two remarks then:
1) To remove documents that are more than 60 days old, don't use an agent but set ofne of the space savers properties of the database: File/Replication/Settings, Space Savers, Remove documents not modified in the last -> 60 days. Very clean, the server will do the work for you.
2) You gain a lot of flexibility and speed when you enable FullText-searching and you creat the right search-string to find the documents you need. The syntax for FTSearch() is more difficult than for Search(), but there is a lot to be gained. If everything stays invisible to the user, there is no real need to create a view. Anyway, that view would have to be rebuilt every time, at considerable cost. I suggest to use FTSearch.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16370099
witgrefe,
you can consider creating the view programatically, from LotusScript.
Here's an example of view that contains all docs in the db that are created before last midnight with form "FrmName":

    '...
    strSelect = |SELECT ( Form =  "FrmName" ) & ( dateFieldName1 < @Date( @Today )|    
    Set viewTemplate = db.GetView( "(TemplateViewName)" )    'Use this if you want view created by copying the existing view (uses all of template's design except view's name and selection formula)
    Set viewNew = db.CreateView( "NewViewName", strSelect, viewTemplate )
   
    'loop through all view's docs
    Dim cur As NotesDocument
    Set cur = viewNew.GetFirstDocument()
    Do Until cur Is Nothing
   
        Set cur = viewNew.GetNextDocument( cur )
    Loop
    '...
   
    'after the calculation you can delete the newly created view
    Call viewNew.Remove
    '...

Hope this helps,
Marko
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16370142
To create or change a view, you need Designer privilege...
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16370150
Ignore that last remark. You need some privilege, i.e. to create personal views.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16370488
But, as I understood, this process of collecting stats is done by an agent.
That means that the agent can be run on behalf of someone who is Manager od Designer, or can be signed with the Manager's or Designer's ID.

Am I right Sjef?

Marko
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16370632
True, true, but then it can never be an agent that is started by any user. If that's no problem, then do that. IMHO, creating a view just to throw it away a few minutes later can't be the right solution.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16370646
When the user doesn't have Designer access and runs the agent Notes crashes (NSD) when trying to create view,
but if the user is Editor (or above) and has option Create shared Folders/Views in ACL enabled everything works fine.
Running LN 6.5.1

Marko
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16371516
Which "proves" my point: don't design views "on the go"
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16371748
sjef_bosman,
> IMHO, creating a view just to throw it away a few minutes later can't
> be the right solution

Why not?
If that works and works fast (remember FTSearch on massive dbs) and the view is deleted afterwards and all together does the job, then I consider it to be a good workaround (trick).
Inspite of all that, I suggest not using this code on production db before thorough testing, especially if the @Today (or other current date/time related functions) is used.


> Which "proves" my point: don't design views "on the go"
This doesn't prove your point (want an analogy? ;)


Regards, I'm going home, see you tommorow,
Marko
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 200 total points
ID: 16372601
Creating a view on a huge database is VERY time-consuming. FTSearch is a lot faster. The fastest solution would be a permanent view with all documents sorted by creation date in the first column, in the format yyyymmdd to enable simple searching (if required

Regarding "proves": that's why I put it in double-qoutes... ;)
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16436355
witgrefe,
which solution did you use?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  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…
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.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Screencast - Getting to Know the Pipeline

850 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