i have a form where custoemer can fill project revenue values /month for 12 months.Now I should create a view that shows those values for 6 months from the moment view is opened.
I think this is not so simple, am I wrong? hope so
i have a form where custoemer can fill project revenue values /month for 12 months.Now I should create a view that shows those values for 6 months from the moment view is opened.
I think this is not so simple, am I wrong? hope so
Subject: Dynamic view
In a way you are right. You could make your life very easy by just comparing the @Created date with a value based on @Today, that you transform to somethhing 6 months from now using @Adjust. That’s actually very easy.
But the use of @Today in most cases is not acceptable from the performance point of view. But if you search this forum for “view and today”, you will find dozens and dozens of posting talking about better alternatives.
You will also find dozens of documents telling people to search for the solution, but remember that those documents would not be there, if all who have asked the same question before had searched prior to posting …
Subject: RE: Dynamic view
I have searched a lot, I always do before asking around. So I keep on searching and hope to find help somewhere.
Subject: RE: Dynamic view
It’s all here:
Subject: RE: Dynamic view
yes thaks I found it by my self by words you succested. I thought this forum is for searching and giving help, sorry if my question was stupid but often it is problem to find the right words for searching help.thaks anyway
Subject: RE: Dynamic view
Your question wasn’t stupid and this isn’t all simple. In fact, many developers still approach this in an inappropriate way. I also fully agree that the problem is often just to find the right term to search for.
The thing is: If there was an official top ten of the most often asked questions, this one would be comfortably in it. Things would be easier, if you had an idea what those frequently asked questions are. Doug Finner had maintained an “FAQ of FAQs”,
which used to be linked to from the navigation on the right. Unfortunately, IBM decided to remove that link without coming up with a suitable replacement.
Answering the same question over and over again is no fun. So I hope that in the end you will rather remember this forum as the place where you found an answer to a problem, not as the place where big-heads tell you to learn how to search.
Subject: RE: Dynamic view
It was stated somewhere in the documentation, that using date in the view will slow down the database performance a lot.
My solution is to use agent to display the view.
I can still have the view which consists of all the records.
But in the agent, I compare the documents date with today’s date, and display them by writing a HTML code.
In that way, the view is only refreshed when users generate agent.
Hope this helps
Subject: Dynamic view
Hard-code the date into your selection formula, then update it once a day via a scheduled agent. This agent must have Designer access. Example code:
' *******************************************************************
' Pushes a hard-coded date into the selection formula of
' certain views, so they do not have to use @Today etc.
' *******************************************************************
Dim s As notessession
Dim db As NotesDatabase
Dim view As notesview
Dim dtx As NotesDateTime
Dim formula As String
Set s = New notessession
Set db = s.currentdatabase
Set dtx = New notesdatetime("Today")
' *******************************************************************
' View #1: "a. Use this view to set docs as Expired"
' *******************************************************************
' *******************************************************************
' Original formula:
' *******************************************************************
' SELECT Form = "XYZ" & IsDraft != "True"
' & SomeField < @Adjust(@Now;-1;0;0;0;0;0)
' & !@IsAvailable(ACTION_DELETE)
Set view = db.GetView("a. Use this view to set docs as Expired")
If Not view Is Nothing Then
Call dtx.setnow
Call dtx.AdjustYear(-1)
formula = "SELECT Form = ""XYZ""" &_
" & IsDraft != ""True""" &_
" & SomeField < [" & Format$(dtx.LSLocalTime,"mm/dd/yyyy") & "]" &_
" & !@IsAvailable(ACTION_DELETE)"
view.SelectionFormula = formula
End If
Run the agent just after midnight. If your application is on a template, and DESIGN is running, run the agent just after Design runs.
The resulting view will be accurate only for the date zone in which it was run. So if the agent runs in Atlanta the view will be off by a day for users in Shanghai.