Check for data in a SP2010 list and edit item or add to the list - InfoPath Dev
in

InfoPath Dev

Check for data in a SP2010 list and edit item or add to the list

Last post 05-26-2013 11:46 PM by MeganW. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-07-2013 10:43 PM

    • MeganW
    • Not Ranked
    • Joined on 05-07-2013
    • Posts 2

    Check for data in a SP2010 list and edit item or add to the list

    Hi All

    I'm hoping someone can help me with my form functionality.  I'm using InfoPath2010 to write information to a SharePoint 2010 list.  My list is a list of organisations we deal with and already exisits in SharePoint with some organisations already input - it typically has the following columns:

    • Title (text)
    • Address (multiline)
    • Type (choice)
    • Topic (lookup from another list)

    there area  few other columns but they are either text or lookup.

    I have placed the infopath form in a webpart on a page in SharePoint.  I've figured out how to submit the form when someone has filled out all the appropriate info, this writes a new item in the list, pops up a box saying their entry was successful and refreshes the page with a blank form ready to start again.

    I want the user of this form (i.e. people entering new organisations or updating existing information) to be able to check if an entry already exists, if it does then I want them to be able to edit that info and write it to the list or if not, to enter the new organisation and write it to the list.

    My methodology so far is:

    1. type the name of the organisation
    2. click a button to query the existing list
    3. return the results to the list input fields if it exists, OR display a text box saying "does not exist - please enter the details in the following fields"
    4. on submit it updates the list and refreshes the page to present a new input form

    So, I want to display only the title input field and the button to begin, then display the items noted in point 3 above.

    What I don't understand is the conditional formatting I need to do with the fields.  Logically I think I should be able to label the Title text box, put a rule on the button i.e. when clicked a) query the SP list for the title b) write information to the fields. 

    I dont know how to write the query for this I am trying to match the Title field on the form to the Title field in the list.  I can see the rule action to query a data source,ok, but what is the programming stuff I need to do?  I can see how to set a value of a field and can probably work out how to do this for all the extra fields but not sure how to write the conditional stuff for matching the title.

    Oh dear, that sounds all very confused!

    If anyone can help I'd be really grateful!

    thanks
    Megan

     

    InfoPath2010
  • 05-20-2013 01:21 PM In reply to

    Re: Check for data in a SP2010 list and edit item or add to the list

     My initial reaction is break it down into smaller chunks and use multiple views.

    Can you at least get your form to connect to the SharePoint (SP) list? and set fields from SP to fields on an infopath form/table. Don't worry about marrying them up just yet. Can you at least pull some SP data into an infopath form.

    Can you get to that stage?

    Use a form status field. It's default vaule could be does not exist.

    Otherwise something like:


    1. Search for company info view include a button which queries for data and writes to fields as necessary and updates a form status field or something thereof. Also you can switch to view 2.


    2. Edit/Create company info view. the button above uses a set field X rule.


    3. Dummy is for testing and playing.

  • 05-26-2013 11:46 PM In reply to

    • MeganW
    • Not Ranked
    • Joined on 05-07-2013
    • Posts 2

    Re: Check for data in a SP2010 list and edit item or add to the list

    Hi

    Thanks for the reply.

    Yes, I am able to pull in data from my SharePoint list (secondary data source).

    What I am really trying to achieve is for a user to do the following steps in the infopath form:

    1. scroll through a drop down list to "check for an item" in the SharePoint list (this I can pull in from the Secondary data connection in InfoPath to the SP list)
    2. select the item and check all the fields are correct
    3. edit the fields if necesary
    4. submit the updated data to the SP list

    I am comfortable with views and can switch between the add a new item view I have created (this is the Main data connection and has all the fields in the SP list contained in the form) and to another view that shows the data.

    But I am getting stuck at the point that I compare the drop down list from the secondary data source to the fields I want to display

    I am testing the "check for an item" view by using just the 'Title' field at the moment.  I can display the 'Title' field for all records in the list in both the drop down list and the repeating section (so this shows the Title for all the items in the SP list)...but..how do I filter out only the item I want to display?  what is the query or rule I should use to check what was selected in the drop down list?  I've tried lots of things from formatting/hiding etc but I'm stumped.

    Using both SP2010 and InfoPath2010 and I'm not a programmer...you can tell right? :)

    thanks again

    Megan

     

    InfoPath2010
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.