?
Solved

How to load combobox with a field from a Profile Doc?

Posted on 2006-03-21
5
Medium Priority
?
651 Views
Last Modified: 2013-12-18
I have a profile DOc that contains a text field allowing multiple entries, which are district codes ( 3 characters each).

I hae a data entry screen , and I want to use a combobox, so the user can choose the district code from the list in the Profile Doc.

I would like to know to do this ?

I have tried the following in the postopen ( creating a copy of the field in the data entry Form )

All items are declared in the Form globally.

Sub Postopen(Source As Notesuidocument)
      ' Prepare list in a field for District Lokkup
      Dim cnt1 As Integer
      Set S= New NotesSession
      Set CurDb = S.CurrentDatabase
      Set prfDoc = CurDb.getProfileDocument("DL_Prof")  
      Set SRdoc=source.Document      
      
      'DLItems is now a hidden field, use it
      
      Set DLitem = prfdoc.GetFirstItem("DL_DC_Field")
      ' DL_DC_Field
      cnt1=1
      ' Dim DistList As String
      Call  SRdoc.CopyItem( DLitem, "DLItems" )
      
'      Forall itemValue In DLitem.Values
'            cnt1=      cnt1+1
''            Messagebox "Values:" & Chr(10) & itemValue
'      End Forall
'      Print cnt1 ' debug
'      DistList=prfdoc.DL_DC_Field(0)
'      Print itemValue ' debug
      
      Call SRdoc.Save(True,False) ' Delete after testing without.
End Sub

I can see the field with the correct data.

In the Combobox I have the list set from the functions to use field DLItems

Opening a doc shows the field correctly

Field Name: DLItems
Data Type: Text List
Data Length: 677 bytes
Seq Num: 1
Dup Item ID: 0
Field Flags: SUMMARY

"001"
"
002"
"
003"

The Combobox is empty- No list to pick from.

Any help resolving this appreciated.
0
Comment
Question by:SysExpert
  • 3
  • 2
5 Comments
 
LVL 18

Accepted Solution

by:
marilyng earned 1200 total points
ID: 16254131
If this is a true profile document, then to gather info from it you have to use: @GetProfileField( profilename ; fieldname; uniqueKey );
So your hidden field, make computed for display, multivalue and set it to: @GetProfileField( profilename ; fieldname);

I tested putting the value directly into the combo box formula.. no problem.  Default profile field was "001":"002":"003".

Then you don't need to do all that stepping on the postopen, that you would have to repeat on the postmodechange anyway :)


Also, if true profile doc, it will always exist, so testing if it exists will always return true, even it has not been saved.  So, if the values are fairly constant, then it helps to put some default values into the fields, because ya'shura, they'll return even if you've never opened and saved the profile doc.

To set fields, use @SetProfileField("thisField";"thisValue").

The problem with using items, is that the push doesn't happen fast enough to load into the combo box.  So while it exists on the form, the combo box doesn't see it, until you destroy source to clear it's cache.  :)
0
 
LVL 63

Author Comment

by:SysExpert
ID: 16258191
Thanks marilyng , we are getting closer.

The issues is now, I only see 001 since my profile doc has the items separately as
001:002:003:004:005;
006;
007;
009;
010;
011;

originally set up with semicolon since each is a separate entry, for testing used a colon for the first 5, and it showed up as a single entry in the combobox.

Interestingly, the box shows lots of BLANK entries.

We are closer.
Any other suggestions ?
0
 
LVL 63

Author Comment

by:SysExpert
ID: 16259121
OK, I created a new field, and it appears to be working fine.
Thanks !
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16259667
"001":"002":"003":"004"  << multivalue field in the profile doc, separate each with anything you want.  Collect to a multivalue field, separate any way you want, on the combobox, just reference the field or the profile doc.

:))

So, enter this: "001":"002":"003":"004" in your profile formula.
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16263956
Can be wrong, but think profile docs, or @GetProfileField returns strings.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Loops Section Overview
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question