Hi,
Is there any way of getting value from profile document located in some other database but in same server. Please let me know if its possible or any ideas how to achive this by using some other command.
Hi,
Is there any way of getting value from profile document located in some other database but in same server. Please let me know if its possible or any ideas how to achive this by using some other command.
Subject: @GetProfileField not working if located in other database
This should work.
Dim OtherDatabase As New NotesDatabase(“”,"')
Dim ProfileDoc as NotesDocument
If OtherDatabase.OpenByReplicaID(“servername”,“replicaid”) Then
Set ProfileDoc = OtherDatabase.GetProfileDocument(“formname”)
End If
Subject: RE: @GetProfileField not working if located in other database
Thanks for response, but how about using a formula. Since I am using a combobox and that can use formula.
Subject: RE: @GetProfileField not working if located in other database
No can do. @GetProfile only works in the current database, that is why you have to use LS. However, what you could do is create a computed field on the form and set the field’s value using LS on the open event. Then set the combo to that field.
This is one of the many reasons NOT to us profile fields for field lookups.
Subject: RE: @GetProfileField not working if located in other database
I would say that it is a good reason to not use Formula language unless you absolutely have to. I know there are many who disagree with this position and I do not want to hijack this thread and turn it into a debate about formula vs LS since there have been countless discussions about this already.
I do wish to request some clarification from “J.F.” about the comment made about profile documents though. What were the other “many” reasons for not using profile docs? I have never heard of one legitimate one. Anyone else? You ever heard of any issues surrounding the use of profile docs?
Subject: RE: @GetProfileField not working if located in other database
Hey,
Sorry its me again and thought of posting it here rather than create a new forum thread as it is continuation. I did what you asked me to do and got the values but in a hidden computed text. When I use that in Dialog box formula it works fine when there is no any existing or saved value.
But if document contains any value for that field then the values got by your coding does not get display. Just the saved value. I am doing anything wrong.
The code to get profile values is in postopen and then dialog box formula is something like this
@if(location != “”; location : ; )
Subject: RE: @GetProfileField not working if located in other database
Hey Prem,
You will have to post a bit more info on the specific details of your implementation. Perhaps it is something to do with the form control used in your dialog box?
Subject: RE: @GetProfileField not working if located in other database
Well here are the detailed info
Two databases db1 (which contains profile form/documents) and db2 (which gets value from db1 profile form). In db2 there are 3 forms - form1, form2 & form3. Now in form1 postopen the coding is as follows
Dim otherdb As New NotesDatabase( "", "" )
Dim ProfileDoc As NotesDocument
Dim ProfileLocations As NotesItem
Dim ProfileRep As NotesItem
Dim ProfileType As NotesItem
If otherdb.OpenByReplicaID("<servername>","85256F6C006D95F5") Then
Set ProfileDoc = otherdb.GetProfileDocument("Profile")
Set ProfileLocations = ProfileDoc.GetFirstItem("Office_Location")
End If
Call Source.FieldAppendText("Location", Implode(ProfileLocations.Values, ";"))
Office_Location is dialog list and Location hidden computed field. Getting values from Location to Office_Location, the formula is as below
@If(Office_Location != “”; Office_Location : Location; Location)
Thats the coding part. And the real problem is when I open a document to edit it and if Office_location already has saved value then values from Location doesn’t get displayed. But whereas if office_location is empty then values display perfectly.
Hope now you were able to understand the scenario
Subject: RE: @GetProfileField not working if located in other database
I don’t understand what you mean by “dialog box formula” – is that actually a keyword formula?
Don’t try to read profile information from another database. Just have an agent to synchronize the profile information between the applications. I don’t believe you get the advantages of profile document caching if you read it from a different database. At least, your application is more complex here than it needs to be.
The Postopen event is too late to be reading values to be used in keyword formulas. The keyword formulas will probably already have been calculated by that time – particularly if you have a value in the field, because Notes has to know how to display the value. If the formula returned something with “|” (vertical bar) in it, it would have to show the appropriate display text (to the left of the |) if the value matches the synonym (to the right of the |). You might not have | in your keyword data, but Notes doesn’t know that until it calculates the value.
Oh, and you can’t use AppendItemValue to append multiple values by using the delimiter character of the multivalue field. When you work in the back end, Notes expects you to work with lists as lists. You would have to append each value. It’s a moot point here because I disagree with your whole approach, but for future reference.
Subject: RE: @GetProfileField not working if located in other database
Hi Andre
I’m new to Lotus Notes so if you can show me code for agent as to how it synchronizes the profile information. If that looks simpler I will go for that option or will have to go same approcah but by appending each value. Thanks for your response. Or maybe the code which i sent you can modify and send it across
Subject: RE: @GetProfileField not working if located in other database
Sorry guys but I did give in more information of what I am doing any ideas? Dave or JF or anyone
Subject: RE: @GetProfileField not working if located in other database
Hey Prem,
It all appears to be OK, but obviously it is not due to the fact that it does not work. Based on your observation that it does not work if Office_Location has a value, then I would concentrate my efforts on the part of the formula that does your concatenation. I suggest that you try and add some implode/explode calls to see if that helps.
Change
@If(Office_Location != “”; Office_Location : Location; Location)
To
@If(Office_Location != “”; @Explode(@Implode(Office_Location;“;”) + @Implode(Location;“;”);“;”); Location)
Subject: RE: @GetProfileField not working if located in other database
This kinda funny I tried your coding and other possibiliteis too but still the same thing. I will give it a try for another day or two after that I give up. It is so irritating to get this piece of code.
Subject: RE: @GetProfileField not working if located in other database
Are both of the fields using the semi-colon to delimit multiple values?
Subject: RE: @GetProfileField not working if located in other database
Yes
Subject: RE: @GetProfileField not working if located in other database
Hi there Dave:
Yes, you are right: there would be many who would disagree about not using Formula language unless you absolutely have to, and I would be one of them. Of course, these discussions often have a tendency to descend into religious arguments. That said, I am happy to share my thoughts around 3 legitimate reasons.
Generally, I try to use profile documents for the storing of database preferences, whether “global” and across the whole Notes domain, for that specific database, or for individual users. While they provide an easy and efficient way to provide database lookup capability, this tends to be the case only when the lookup in question will never be needed by another database. As the databases I develop tend to be “suites,” with several databases working in tandem, profile documents don’t meet my needs at all. I much prefer to use standard notes documents for storing keyword values, and using a dblookup in the dialog box to retrieve those values, because as this user has discovered, you can’t use formula language to access profiles across databases. That is reason 1.
The second reason is that profile documents are not considered documents in the traditional sense at all, which can create some issues, especially around local replicas. I have seen databases which, on the dbopen event, reference a profile doc. Pity the poor user who attempts to open their new local replica BEFORE it is completely created. The database creates a “new” local version of the profile document, and now they will never get the server version one down. They have to blow their local replica away and build a new one.
The 3rd legitimate reason regards the caching of profile documents in the Domino http engine. Changing a profile document is not reflected by the engine, and while I have seen some solutions that depend on running an agent in the browser which tells the http task that the profile has changed, the only 100% solution is to restart the task. This does not occur when using standard docs.
But to close, I am not looking for a war or any zealotry. I agree that profile documents are extremely useful (as is formula language), but also want to clarify that one needs to know the pitfalls if they decide to use it (dot notation, anyone?)