Form Formula revisited

I would like everyone to see the information in a view.
Currently on the people listed in Authors field are seeing the documents in a view, wever if they ry o open the document then hey are rediected o an other form

Here is what I currently have

     @UserNamesList *= WhoCanSee : NameFull; "These are fields"
          "ErrorMessage")  "Error form"
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What is the name of the other form that author is presented with ?

@If( @IsNewDoc; @Unavailable;
@UserNamesList *= WhoCanSee : NameFull; Form;
@IsMember( @Name([Abbreviate]; @UserName); @Name([Abbreviate];@Author)); OtherForm;

adspmoAuthor Commented:
adspmoAuthor Commented:
I would like everyone to see the information in a view.
Currently only the people listed in Authors field are seeing the documents in a view,
So in the view I want the regular users to see the info at the view level
If they try to open a document then they get the not autorized message("ErrorMessage)"
If they are authorized then the document opens as normal with either "leave_fm" or: LSF"

Here is what I currently have

     @UserNamesList *= WhoCanSee : NameFull; "These are fields"
          "ErrorMessage")  "Error form"

I am trying to understand what this formula is doing

@If( @IsNewDoc; @Unavailable; "Delete what"
@UserNamesList *= WhoCanSee : NameFull; Form;"What does the * do"
@IsMember( @Name([Abbreviate]; @UserName); @Name([Abbreviate];@Author)); Form; "I do not get this part at all"

Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

The formula says if you are composing Newdoc, then nothing should be done.. so setting Form Formula as some 0 value, you can set it to @False  or @True too.

If the UsernamesList for current doc matches that of whocansee and Namefull fields then he is a author so it will open the doc with form..

Since you said that Authors should open another form I thought it was redundant in first place but still provided an option so that he/she can open the doc with another form. This works only for usernames...where above urenameslist works both for roles and names

I believe now everyone is able to see that data in the view.. And it is working as describe above .. Right !!

So what is the exact problem now ?

adspmoAuthor Commented:
It doesn't work

If they are not included in the  WhoCanSee : NameFull then they should be able to see the field values in aview, If they try to open and are not members of WhoCanSee : NameFull then they are redirected to ErrorMessage(form name) If they are included in WhoCanSee : NameFull then the document opens with the form it was created with
@If(@IsNewDoc; @Unavailable...
Means as much as if you're starting a new document, act as if there's no form redirection (as "delete the form formula")

About *= : designer help shows a great example where list comparissons "=" and "*=" can be compared.
"A":"B":"C"="B":"C":"A" returns False; since no sequence of one list can be found in the other
"A":"B":"C"="B":"C" returns True since the list "B":"C" occurs in the the other list
"B":"B":"C"="B":"C" returns True for the same reason.
So you're not comparing individual elements, but entire lists.

That is what you want to do if you want to compare @usernameslist (your concatenated name, canonicalized name, abbreviated name, all groups you're in, all userroles you have) with whatever is held in the authors field (names, groups, roles): if there is a single element in those to matching, then you want to show the full form. That's what "*=" does...
"A":"B":"C"*="B":"C":"A" returns True, since both lists have elements in common
"A":"B":"C"*="B":"C" returns True for the same reason
"B":"B":"C"*="D":"E" returns false, since none of the elements match

(see designer help, do a full-text search on "*=". Do use the quotes in the search bar too!)

The last part reads:
If the abbreviated form of your username (User Name/OU/C) equals the abbreviated form of an element in the authors field(only the first available; if none, then use the From field or $UpdatedBy). I'm not really in favour of this method since the authors field may contain groups and roles!And what if there are multiple author fields?

Back to hemanth's solution (I don't understand what you're trying to archieve this time), you might want to try:
@Name([Abbreviate]; @UserNamesList) *= @Name([Abbreviate]; AuhtorsField1 : AuthorField2); Form

What do you think Hemanth... should we add @Lowercase too?
Sorry.... I missed a few posts while typing that!
It sounds like the formula is doing what its supposed to do. Two concerns though:

Are names in WhoCanSee : NameFull selected (ok), computed (ok) or typed. In that last case we may need to see if a typo (or case sensitivety) is causing your problem.

You also sound a bit like "not everyone is capable of seeing all doc's in the view". If so, do some doc's hold a readers field as well?
adspmoAuthor Commented:
There are no readers field

THe values are computed
Are you testing it on local then?
Please give us detailed info on a specific case that goes wrong. Including the (important) values of those fields. You can copy those values from the propertybox!
Yes Crak..It Could be case sensitiveness

Pair-wise comparison is OK.. not a problem.

@UserNamesList *= WhoCanSee : NameFull
@Name([Abbreviate]; @UserNamesList) *= @Name([Abbreviate]; AuhtorsField1 : AuthorField2)

will work unless WHoCanSee, NameFull is of Names or Authors type (just ruling out readers in this case).

James, Goto the field properties of WhoCanSee, NameFull and list it here. Also the data type as seen from property box
One morething WHoCanSee and NameFull should be multivalued :-)
Good point!
adspmoAuthor Commented:
Field Name: WhoCanSee
Data Type: Text List
Data Length: 98 bytes
Seq Num: 2
Dup Item ID: 0

"Abhinav Chandra"
"CN=Migaly Lopez/OU=North America & Caribbean/OU=New York/O=SITA/C=WW"

Field Name: NameFull
Data Type: Text
Data Length: 15 bytes
Seq Num: 1
Dup Item ID: 0
Field Flags: SUMMARY

"Abhinav Chandra"

And the user is....?
Does he/she have [Admin]?
Can he/she see the doc in the view?
What form is used when opened by the user?
Sorry about me "he/she"-ing.... I can't tell from those names.
adspmoAuthor Commented:
THe user is the person in the NameFull field

They do not have Admin

They can see the doc and it opening with the right form

I have temporarily removed the form formula as this is driving me nuts

I do need one that will work

Can Read /Edit

Not Authorized just sees the info in a view
Try this one

@IsNewDoc; @Return(Form);
@isMember( @Name([CN];WhoCanSee : NameFull) ; @Name([CN];@UserNamesList) ); @Return(Form);

Let me know
This is a bit confusing.  Let's break down the original formula, and you tell me what's either not true or not matching expectations:

I took out the "comments" you put in (These are fields and Error form), but otehrwise left it alone

1 @If(
2     @IsNewDoc;
3          @Unavailable;
4     @UserNamesList *= WhoCanSee : NameFull;
5          Form;
6          "ErrorMessage")

1 Decision tree starts

2 Test if requestto create document (versus request to open existing document)

3 When test succeeds (is a new doc), cancel form formula via @UnAvailable, which leaves the user-requested form (or @Compose named form) as the result

4 Comparison test -- if any of user's names, groups, or roles, matches any member of the WhoCanSee or NameFull fields

5 When test succeeeds (existing document, there is some name match), use the document's specified form

6 DEFAULT: When all tests fail (existing doc, no name match), use form named ErrorMessage

So, disregarding new documents...
If a user matches the "access" criteria, it displays using tehnoral form, otherwise, an error form appears.

How the comparison test works: This is called PERMUTATION EQUALITY.  Whenever Notes uses a * comparison, it actually compares all elements of the left side to all elements ofthe right.  Permutated addition works simialrly:

1:2 *+ 3:4 = (1+3) : (1+4) : (2+3) : (2+4) = 4:5:5:6

A:B *= C:D:E means test of any of the following are true: A=C or A=D or A=E, or, B=C or B=D or B=E

So, whatever @UserNameList returns is matched, one by one, against each value returned by WhoCanSee:NameFull

If you want to se what is being compared, put the follpwing formula in:

@Prompt([OKCANCELIST]:[NOSORT]; "Permutation equality - result " + @If(@UserNamesList *= WhoCanSee : NameFull; "TRUE :)"; "FALSE :("); "If any of the following are true, test succeeds"; ""; @UserNamesList *+ WhoCanSee : NameFull);
    @UserNamesList *= WhoCanSee : NameFull;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
> "A":"B":"C"="B":"C" returns True since the list "B":"C" occurs in the the other list

This is an incorrect explanation.

The comparison is unbalanced, since "A":"B":"C" has three eleemnts and "B":"C" has only two. So, Notes "doubles" the last element on the short side to fill it in.  The following two comparisons are identical:

> "A":"B":"C"="B":"C"
> "A":"B":"C"="B":"C":"C"

ANd what BOTH of these do internally is:

"A"="B"? False, continue...  (element #1 on left compared to element #1 on right)
"B"="C"? False, continue...  (element #2 on left compared to element #2 on right)
"C"="C"? True, return true!  (element #3 on left compared to ****VIRTUAL**** element #3 on right)
Hmmm..... yep! Thats why it returned true.
My mistake!
Anyway.... I try to avoid situations like that in general. Though explained well now, it causes undesired (unexpected for most) side effects.

Suddenly the question is closed with an A, but I haven't seen any changes!

What's cooking, James?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.