Question

I have formA where I have "_reviewer" field, which is text/editable. The field is populated when the save button is clicked, the button has the following code:

pick := @Name([CN];@PickList( [Name]));
@SetField("_reviewer"; pick );
@If(@Command([FileSave]);
@Do(
@MailSend(pick;"";"";"Subject";"Body";"";[IncludeDoclink]);
@Command([CloseWindow]);
@StatusBar("Success.")
);
@StatusBar("Fail!"));

I have viewA where document should be shown if the current user is the same as the person in '_reviewer' field, the code in View Selection is:

LCName := @LowerCase(@Name([CN];@UserName));
LCPeople := @LowerCase(_reviewer);
SELECT form = "formA" & (@Contains(LCPeople; LCName))

I have another viewB, where I can see all documents, and one of the columns is '_reviewer'. Now the issue is, even though on viewB I see that John Doe is reviewer for a documentA, the documentA is not shown in viewA when John Doe is logged in as the current user. The tricky part is, documents sometimes show up in viewA, and sometimes they don't, even though I repeat the same steps when creating the document. Having this behavior is unacceptable. Is there some other way to parse the current user and the user picked from @PickList, or some other way to check if the two are the same?

Was it helpful?

Solution

Use an embedded view in a Page like suggested in your last question. This time first categorized column would be @LowerCase(_reviewer) and "Show single category" would have formula @LowerCase(@Name([CN];@UserName)). The view selection is SELECT form = "formA".

You can't use user specific functions like @UserName in public view's selection formula.

OTHER TIPS

Also note, that the user can save the document by pressing Ctrl+S or by closing the window and selecting Yes when prompted. They don't have to use your Save button. If there's really something that must happen before the document is saved, it must be done in the form Querysave event. If it has to happen after the document is saved, it must be in the Postsave event. Kudos for checking the return value of the save command though!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top