Link to home
Create AccountLog in
Avatar of SysExpert
SysExpertFlag for Israel

asked on

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

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.
ASKER CERTIFIED SOLUTION
Avatar of marilyng
marilyng

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of SysExpert

ASKER

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 ?
OK, I created a new field, and it appears to be working fine.
Thanks !
Avatar of marilyng
marilyng

"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.
Can be wrong, but think profile docs, or @GetProfileField returns strings.