I need your help to create a view selection formula (I seached without success)…
The context :
In a forum-like application, my users create Topics using a form called “FmMsg”.
Every topic document can have response documents based on the form “FmReply”. Those are the replies to the topic.
Every topic document also has one unique response document based on a form called “FmTracking”. That document stores (in a field called “FldMTrackers”) the name of the people who want to recieve a notification whenever a change is made to the topic or a reply is posted (yeah, like the “send me a mail listing new responses …” when you post on this forum)
The problem :
I want to give my users a view that lists all the main topics that they ‘track’. But can’t formulate the … formula
To sum it up, the final result should be a view that only displays the documents based on the form “FmMsg” for which the repsonse document based on “FmTracking” contains a given value in the field “FldMTrackers”(i.e. @username).
Subject: View selection formula :How to display docs whose child contain a given value
Notes won’t do that directly. The selection formula can only see items inside each document as it’s being considered for inclusion in the view.
So you need to do this indirectly. When you save one of these response documents, have some logic in the PostSave event to update a flag field on in the parent document. You can then use that flag field as the basis for your selection.
This gets more complex if these response documents can be deleted. In that case, you need a counter rather than a flag, and you’ll need to capture the Deletion event in the Database Events to decrement the counter when one is deleted.
Subject: [SOLVED]View selection formula :How to display docs whose child contain a given value
Hello and thanks a lot for your replies.
To Thomas : Thanks. But your suggestion seemed far too complicated for the time i can spend on this (that’s probably because I’m not yet good enough ! )
To Graham : thanks for your suggestion, but I couldn’t implement it due to the ACl of my base : the people who reply a just authors and can’t modify a flag inside the parent document, when another user created it. But that gave me the idea to do it the other way round
So I had to make without direct access to the parent document ? Right. Instead, my view simply lists the tracking (response) documents containing the username, like this :
SELECT Form = “FmTracking” & @Contains(@GetField(“FldMFoTrackers”);@Name([Abbreviate];@UserName))
Once that was done, all I had to do was modify the script creating the tracking documents so they would include a doclink to the parent document.
My users now have a list of the topics they track. When opening a doc of that list, they are given a link to the topic. It takes 3 clicks instead of 2, but the result is there.
Subject: View selection formula :How to display docs whose child contain a given value
You cannot do that with a selection formula.
You can come close with a form. If you create a hidden view of FmTracking docs categorized by FldMTrackers, with some descriptive label from FmTracking in the second column, you can then create a form with a listbox whose values are the FmTracking labels categorized under the current user’s name. You could then use the selected value in that field as a single-category value on an adjacent embedded view, to make the view display just that FmMsg doc (and its descendants if they are also in the view).
If you have a little money, and you can use an ActiveX control, consider getting Loyal View. It’s a control that wraps around an existing view, giving it an expanded event model and scripting interface. You can put two of them on a form and have them talk to each other, and so on.