Selection formula in "CreateView" function

Hello,

I’m trying to create a new view in a database that is a subset of another view (“Usage”).

I use db.CreateView to create the view, and I’m not sure if you’re able to use formula language in the select statement. Here is the relevant code:

selection = "SELECT "

selection = selection + “SessionFaculty = @GetProfileField(‘StatQuery’; ‘qFaculty’; @Name([CN]; @UserName))”

Set vw = db.CreateView(“QueryView” + s.CommonUserName, selection, db.GetView(“Usage”))

I used to have working code that looked like this:

faculty = Evaluate(“@GetProfileField(‘StatQuery’; ‘qFaculty’; @Name([CN]; @UserName))”, s.DocumentContext)

selection = "SELECT "

selection = selection + "SessionFaculty = " + faculty(0)

Set vw = db.CreateView(“QueryView” + s.CommonUserName, selection, db.GetView(“Usage”))

But once I changed it, it no longer works. The reason I changed it is because down the road I will need to add additional functionality such as verifying the date column is within a date range and so on, and (to my knowledge) I cannot do this with non-formula Selection language.

Any ideas?

Thanks in advance,

BV

Subject: Selection formula in “CreateView” function

This code (in Mail Template) to see only encrypted emails works for me:

Dim s As New notessession

Dim db As notesdatabase

Dim view As notesview

Dim viewTemplate As notesView

Set db = s.currentdatabase

Set viewTemplate = db.getview(“($All)”)

Set view = db.CreateView({(Encrypted)}, {SELECT Encrypt=“1” | @IsAvailable(SecretEncryptionKeys)}, viewTemplate)