|
|
|
|
|
|
|
|
|
|
|
|
|
|
User Web profile documents (continued)
@If(@IsError(@DbLookup("";"";"user_profiles";usr;"docid"));"1";@If(@DbLookup("";"";"user_profiles";usr;"docid") = docid; "1"; "0"))
|
This formula consists of a pair of nested @If statements. The first one of these checks to see if we can lookup the unique id document of a document with the same username as is stored in this document. If it can't find one then this must be the first profile document for this user, so we set SaveOptions to "1" to allow saving.
If the lookup succeeded, then we need to check whether the open document is the original profile doc for this user or whether they are attempting to create a second one. If the document id of the currently opened doc matches the id from the lookup then we are editing the right doc and SaveOptions becomes "1", if not, we are trying to create a new doc and SaveOptions stays "0".
Next I created some descriptive text: "Preferred language for" and then a computed text element with the value: @Name([CN];usr) which will return just the common name part of the username in the usr field (Daniel Koffler instead of CN=Daniel Koffler/O=Koffler). The last field on this form should be a drop down list named "lang" with choices of available languages Use a formula for the choice values of:
This looks up the first column value of the "cal_profile" view (which we created in the last article) and returns a list of available languages in the global calendar profile form in the format "English | Lang1" where English is the language name, and Lang1 indicates which set of fields to retrieve the names of days and months from.
Now we need to create the "user_profiles" view we referenced in the SaveOptions field. Create a new view and set the selection formula to: SELECT form="UserPro". Create two columns. The first should be sorted and should have the value of the field "usr" and the second column should contain the value of the field "lang".
Putting it all together To get the popup calendar to successfully store and use individual user language preferences, it must first lookup the name of a user's preferred language from their personal profile document and then it must query the global calendar profile document to get the names of the days and months for the specified language.
To do this, open the "Calpop" form and changes the formula for the "LangInfo" field to be:
1 tLang:=@If( @IsError( @DbLookup("";"";"user_profiles";@UserName;"lang")); "Lang1"; @DbLookup("";"";"user_profiles";@UserName;"lang"));
2 @DbLookup("";"";"cal_profile";"1";tLang+"_digest")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.
The many included activities and demos will make you a pro! Expert instructor help is a click away.
Click here to try a FREE demo course!! |
-- Advertisement --
Teamstudio Edition 25 has shipped
It's finally here! Now that Teamstudio Edition 25 has shipped, listen to our latest Tool Time audio program to find out what's changed. Updates to all your favorite Teamstudio tools will be discussed.
Plus, you'll get an introduction to Teamstudio Undo (formerly known as Teamstudio Snapper).
Tap here to get started! |
|
|
|
|
|
|
|
|
|
|