CAML Technique - To Update SharePoint List - Looping Issue - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

CAML Technique - To Update SharePoint List - Looping Issue

Last post 08-28-2018 11:32 AM by SG123. 13 replies.
Page 1 of 1 (14 items)
Sort Posts: Previous Next
  • 08-23-2018 11:21 AM

    • SG123
    • Not Ranked
    • Joined on 08-21-2018
    • Posts 12

    CAML Technique - To Update SharePoint List - Looping Issue

     Hello, I'm using a Document Library InfoPath. Here, I'm querying one of the receive data connection SharePoint list. I'm using a repeating table to show my SP list in InfoPath.

    I need to update the fields in the repeating table. I've created a CAML Update query to perform the task. CAML template has a copy attribute field and mapped to repeating field of the SP list.

    I have created a Button, and on button click event, I'm mapping (Set fields value) each CAML copy attribute to list fields. Then submit the data connection using UpdateListItems web service.

     Issue is when I click the button. Web service update only the first value of the SharePoint list. 

     I'm not able to create a Loop, so that  Web service update  is repeated for all items in the SP list repeating table.

    Any help on this will be helpful. Thanks 

  • 08-27-2018 08:53 AM In reply to

    Re: CAML Technique - To Update SharePoint List - Looping Issue

    Is your repeating table bound to your secondary data source? I'm guessing it is... if so, you can repurpose a field you aren't going to need for your CAML mapping, like the version field or something - and put your submit rule on that repeating field. Then for your logic, set the field to something it would never be. In the case of version, it could be text like "go" or the number 0. As long as your button is NOT inside a control bound to the repeating data source, you can add a rule to set your helper field (version, in this case) to your desired value and all instances of it will be set. Then the rule will run for each instance of the repeating element. Hope that makes sense - let me know if you need more info.
    Hilary Stoupa

  • 08-27-2018 09:23 AM In reply to

    • SG123
    • Not Ranked
    • Joined on 08-21-2018
    • Posts 12

    Re: CAML Technique - To Update SharePoint List - Looping Issue

     Thanks Hilary for your time.

    Yes, I'm using a secondary data source as a repeating table.

    Would be good, if you can elaborate more on the Logic part  to run the rule for each instance of the table row.

    To give you a view:

    My repeating table have 3 columns: ID, Skill, Proficiency

    I want users to update only there Proficiency for each Skill in the repeating table itself.

    Currently I have a CAML query to update it one by one.

    CAML Structure:

    <?xml version="1.0" encoding="UTF-8"?>
    <Batch OnError="Continue">
        <Method ID="1" Cmd="Update">
            <Field Name="Proficiency" copyProficiency ="" ></Field>
            <Field Name="ID" copyID ="" ></Field>
        </Method>
    </Batch> 

    As per your logic, I have created a  "QItem" field in my main datasource. And set it as "0".

    Kindly let me know the exact rule which I should write on my "Update" button. 

    Thanks again. 

  • 08-27-2018 09:28 AM In reply to

    Re: CAML Technique - To Update SharePoint List - Looping Issue

    Is your repeating table bound to the SharePoint List? Or to the main data source?
    Hilary Stoupa

  • 08-27-2018 10:02 AM In reply to

    • SG123
    • Not Ranked
    • Joined on 08-21-2018
    • Posts 12

    Re: CAML Technique - To Update SharePoint List - Looping Issue

    It's bound to sharepoint list.
  • 08-27-2018 10:11 AM In reply to

    Re: CAML Technique - To Update SharePoint List - Looping Issue

    So, yeah, your helper field needs to also be in the data connection to the list. You may need to walk through the data connection again and include the version field so you can repurpose it. Then, put the rules to set the CAML data source and execute the CAML submit on the version field. The version field will be inside the same repeating group that your form table is bound to - so when the rules fire, they will set the CAML to the correct value for that row. Does that make sense?
    Hilary Stoupa

  • 08-27-2018 10:35 AM In reply to

    • SG123
    • Not Ranked
    • Joined on 08-21-2018
    • Posts 12

    Re: CAML Technique - To Update SharePoint List - Looping Issue

    Thanks for the solution. I may be asking you for too much. Would it be possible for you to give me an example xsn file on the same logic. Basically my bad, I'm not able to get how the CAML will trigger row by row. If my secondary data source has 5 row of data, and I need to update my proficiency for each skill mentioned in the row. How my "version" field will help to update or trigger my CAML update query row by row. My apologies if I'm not understanding you correctly.
  • 08-27-2018 10:37 AM In reply to

    Re: CAML Technique - To Update SharePoint List - Looping Issue

    Can you attach a copy of your template? Under the options tab in a reply.
    Hilary Stoupa

  • 08-27-2018 11:45 AM In reply to

    Re: CAML Technique - To Update SharePoint List - Looping Issue

    Also - here is a basic template that should help show you how executing a rule on a field inside a repeating group will execute the rule for each row. It's a filler sample, so it is just using a pop-up action to demo the concept. Save the file locally, right click and select preview to try it out.
    Hilary Stoupa

  • 08-28-2018 01:43 AM In reply to

    • SG123
    • Not Ranked
    • Joined on 08-21-2018
    • Posts 12

    Re: CAML Technique - To Update SharePoint List - Looping Issue

    Thanks Hilary. I understood the Rule for looping.

    However, when I tried to use the same logic to update "Proficiency" field in my Skills Table using CAML query. Its not updating the SharePoint list items.

    I'm attaching my test form for your reference. I've used SharePoint list as my secondary data source and XML for CAML update.

     Kindly let me know, where I'm missing the logic.

    Thanks as always!  

    Note: Once you save and open the attached form, pop will come to connect to data source. Just click "No" and continue. I've already included SP list items in the InfoPath form. 

  • 08-28-2018 08:05 AM In reply to

    Re: CAML Technique - To Update SharePoint List - Looping Issue

    You have rules set to set attributes in your CAML template - copyID and copyProficiency - but you don't have any rules on those attributes to set the CAML fields. :)
    Hilary Stoupa

  • 08-28-2018 11:11 AM In reply to

    • SG123
    • Not Ranked
    • Joined on 08-21-2018
    • Posts 12

    Re: CAML Technique - To Update SharePoint List - Looping Issue

    Thanks Hilary. But I really don't know how to update the same and where to add this rule to set the CAML field to the attribute.
  • 08-28-2018 11:22 AM In reply to

    Re: CAML Technique - To Update SharePoint List - Looping Issue

    In your data connection w/ your CAML template, in the XML, you have added some attributes. You need to have rules on those to set the appropriate fields. See attached.
    Hilary Stoupa

  • 08-28-2018 11:32 AM In reply to

    • SG123
    • Not Ranked
    • Joined on 08-21-2018
    • Posts 12

    Re: CAML Technique - To Update SharePoint List - Looping Issue

    Thanks a lot Hilary. You are awesome!

    I'm able to understand overall rule now. Thanks.

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