web service, caml code and secondary data question - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

web service, caml code and secondary data question

Last post 05-26-2010 10:30 AM by Hilary Stoupa. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 05-19-2010 07:00 PM

    web service, caml code and secondary data question

    Let me try and explain this to the best of my laymen abilities.

    I am using a secondary data source,and I want to change one column configured as an option ( the value being 1 or 2). Using the webservice and Matt F's. demo. I was able to setup the caml code and everything behaved. Well sort of... With the caml code I get two fields one "ID" and the other "field". I set the caml field(s) with the secondary data "ID" of the row that i am interested in changing the option of. (ideally 1 or 2) However I can't seem to populate them individually. Both fields get assigned with "ID" value and that is what the webservice uses to "updatelistitem" via the caml batch stuff.

    So rather than my option field reading 1 or 2 it reads the "ID" value (of the given row).

    How can I keep the "ID" and assign a value of 1 or 2  to the "field" and populate the secondary data column via web service.

     I have tried doing it in workflow and that has another set of problems? 

    Any thoughts

  • 05-19-2010 10:11 PM In reply to

    Re: web service, caml code and secondary data question

    Hi TexasTwo,

    Which Matt F demo are you referring to? The one where he shows how to map a form to a SharePoint list? If so, that's an old one. Nowadays, we recommend people save time and look at qRules which supports data-driven mapping of XML to SharePoint lists. It's very easy to change it after the fact and no code is required (well, you have to inject qRules, but you don't have to compile). There are lots of other features in qRules.

    Anyway, please feel free to ignore this suggestion and post more details about your solution and we'll try to help you. The problem with Matt F's approach and other's is that it is a tight coupling so when the schema changes, it breaks - and that's what you are experiencing. We recommend loose coupling where the mapping is data-driven. This lets you change the mapping later without having to redo the solution (since the mapping is just a data file).

    More soon,

    Patrick Halstead
    Project Manager at Qdabra
  • 05-20-2010 10:48 AM In reply to

    Re: web service, caml code and secondary data question

    This sounds like you are trying to accomplish what I just finish working through earlier this week. Check out this post and read all the way through. It starts focusing on submitting data to a secondary source and ends on trying to populate repeatable caml fields. I may be misunderstanding what you are trying to do altogether, if so sorry ;)

    -Craig

  • 05-21-2010 10:52 AM In reply to

    Re: web service, caml code and secondary data question

    Hi Patrick,

    I've very interested in Qrules, and have been since I got on board with the post, but I'm also a little gun shy. My workflow all by its self became corrupted and I just recently recovered. Just not sure I'm ready to add another varible to my mix right now.

  • 05-24-2010 02:22 PM In reply to

    Re: web service, caml code and secondary data question

     

    Yes, This is certainly going down the right avenue. Where I beleive I'm hung up is the caml code construction. Simply don't understand enough of the syntax or behavior. I'm using the default code.

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

     Where I'm hung up is this.

    My secondary data has an option box, 1,2,3. I have the option box rule set to populate the caml "field", to @id of the secondary data. My problem is that both the caml "ID" field and the "field" field get populated with @ID. I'm not sure what method ID does at this point so I have left it alone.  Reading thru the link, it was not clear how I can make these varible. I tried using a text box for the "field" to get is value from, but no success. Is Hillary's walk thru of Jimmy's manafest fix, related only to the main source, and not secondary data?

    Thanks!

     

     

  • 05-24-2010 03:40 PM In reply to

    Re: web service, caml code and secondary data question

    This is what I got hung up on too. The key is selecting field for change value rule. Once you have done that, export the source. Edit the manifest.xsf in a text editor. You need to locate the specific rules that will look similar to this

    <xsf:assignmentAction targetField="xdXDocument:GetDOM(&quot;update&quot;)/Batch/Method/Field"

    This is in particular to the XML data source (i.e. CAML query). After Field and before the Quote Mark, Add [@Name='ID']

    Save and rightclick on the manifest.xsf and select design. Now preview the form and it should only change the one field.

  • 05-24-2010 08:42 PM In reply to

    Re: web service, caml code and secondary data question

    Feeling ignorant or brain dead but I'm missing the key"selecting field for change value rule" before I save source? Can you clarify? So the @name="ID" is generic and not specific to your code or schema? I think I'm seeing this. I appreciate all the patience and exertise..
  • 05-25-2010 07:39 AM In reply to

    Re: web service, caml code and secondary data question

    Create your rule to set a Field node in your Batch node to a value. Then, save as source files so that you can manually modify the rule in the manifest file to set the Field node with the name attribute of "ID" to the ID value. All SharePoint list items have an ID, and we need to have that in the Batch node to be able to update via CAML.

    Hilary Stoupa

  • 05-25-2010 11:08 PM In reply to

    Re: web service, caml code and secondary data question

    Ok...ok....Confusion reigns! (Thank you Jimmy! & Hillary! and of course m3_del for the extensive details.) It took reading and re-reading to trigger the light bulb.The [@name='id'] threw me off the beaten path and into a hole!!! OMGosh! My caml default code.<?xml version="1.0" encoding="UTF-8"?>
    <Batch OnError="Continue">
      <Method ID="1" Cmd="Update">
        <Field Name="ID"></Field>
        <Field Name="Choices">Value1;#Value2;#Value3</Field>
      </Method>
    </Batch>
    By default I got my @ID that equaled my row ID from my repeating secondary table. That was always ok. The problem is both fields in the caml "id and Choices" contained the same value.My desire was to keep the ID as it pertained to the Row, but wanted in addition the status of my option box as well 1,2,3. Now if I failed to explain that significant detail or confused along the way....Apologies!(Thank you Jimmy! & Hillary! and of course m3_del for the extensive details.) It took reading and re-reading the three different post to trigger the light bulb. I applied the [@name='id'] from the manifest hack and changed my rule that set field to @ id to set field to 1.  I was limited to the 1,2,3 ids and no others. Basically the extent of my option buttons. One option button with 3 values.

    I removed the [@name='id'] and applied the [@name='choices'] via the manifest hack. I returned the first rule to set (caml) field to @id and then the second rule responds to the hack  Field[@Name = "Choices"]=1 if option one is selected Field[@Name = "Choices"]=2 for option two etc...

    The end result is my 3 options in the sharepoint list dynamically track the infopath form buttons on a row x row basis (or @ID)

    In the End.. Incredibly difficult to annotate, decipher, research, but an incredibly simple to fix...

    Thanks everyone!

     

  • 05-26-2010 10:30 AM In reply to

    Re: web service, caml code and secondary data question

    Hey, great job getting this figured out! It is complex and hard to explain, especially since all the moving bits are going to vary according to each special snowflake situation. Good work, and thanks for updating the thread with your resolution.

    Hilary Stoupa

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