Get individual items from Drop Down List

D

dpsol

Infopath 2007, I have a drop down list that gets populated by a sharepoint
web service on the loading event. This part is working.

After it gets populated, how can I store the items in the drop down list
into a string array? I am a beginner coder, and still learning.

Any help is appreciated.

Thanks,

-sol
 
C

Clay Fox

If you are loading the data in from SharePoint via a data connection you
already have the data in an array in your form. It is in your data sources
and you can use it for more than just the drop down.
Under Data sources in the task pane, use the drop down to switch between any
of your data connections and main data source.
 
D

dpsol

Hello Mr. Fox.
I understand what you saying. I can display the list of items as it DDL or
Listbox on the form, but how do I iterate the list into a local string array
varible.?
 
C

Clay Fox

You could write some code routine to parse through it but I am not sure why
you would need to you since can use filters or other means to grab individual
components. you should not need to transform it, let me know why you need it
in another array?
There may be some sample loop code at http://www.infopathdev.com
 
D

dpsol

Currently this is how my form is setup. I have multiple views. each view is
set for a user or group for routing. each view has the approve or reject
buttons. Any users can open the current state of the form and view its
content, but can not approve or reject the form base on the who open the form
by the buit-in username function. This is where the arrays comes in.

I am using the GetUsersfromGroup web service which retrieve back to me the
users permission group in Sharepoint. I can display the users in listbox or
dropdown, but I don't want to, I just want to place the names of the users in
a local string array so that I can compare it against the builtin username().
And if it match, the buttons would not be grey out.

The only way I can grap the idiviual item if I have a listbox or dropdown on
the form and I have to select it. Which does not make sense in the form
process.

I would love to write some code, but I am still a beginner on coding and
would need alittle help in it. I know a little bit of C# on putting strings
together but I dont know how to retrieve the indivual items into the string
array.

thanks again.

-sol
 
C

Clay Fox

OK this is a common scenario.

First recommendation would be to look at a Active Directory Web Service.
That would give you the windows login of the form user as well access to
their email, department, group membership etc. Works really nice for
workflow. One limitation with your design is that if the user is remote or
accessing via a VPN the local login account probably is different where with
the AD web service it always gets the domain authentication. just FYI.

Typically when the requestor completes the form the name of the approver
would be saved in the form and they might get an email etc. Then on open you
would check the current user vs the approver and if they match show them the
routing buttons.
If using some type of list then you just use a filter. Get permission field
for example where username in list = username().

If you would like to see some working workflow examples, you can email me
here.
http://www.infopathdev.com/members/clayfox.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top