Qrules - Only submit certain lines to a sharepoint list - InfoPath Dev
in

InfoPath Dev

Qrules - Only submit certain lines to a sharepoint list

Last post 10-04-2013 08:52 AM by barrymurphy. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 10-01-2013 02:27 PM

    Qrules - Only submit certain lines to a sharepoint list

    Hello,

     

    I have successfully used qrules  to submit data from a form to a sharepoint list.

     

    I have a new form but I only want the mapped items on certain lines to be submitted to the list. Typically there is a drop down box that has a Yes or No option. If No is selected I need the mapped items to be posted to the sharepoint list.

     

    All lines where a Yes has been selected are not to be transferred to the list.

     

    How can this be achieved with qrules?

     

    Regards

     

    Barry

  • 10-01-2013 02:35 PM In reply to

    Re: Qrules - Only submit certain lines to a sharepoint list

    Hi Barry,

    Yes, this is possible simply by adding the appropriate filter (manually) to the xpath in the mapping file.

    Here's another discussion where Hilary provided some examples:

    http://www.infopathdev.com/forums/t/19803.aspx

    Hope this helps!

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 10-03-2013 11:46 PM In reply to

    Re: Qrules - Only submit certain lines to a sharepoint list

    Hi,

    What if its not a repeating group?

     Here is my mapping file below.

     The field I am filtering is called IP1 in my form and where it is set to "N" I want it to submit so I assune the filter should be written as

    [my:IP1 !="N" ]

    Where do I insert this in the text below? 

    <?xml version="1.0" encoding="utf-16"?>
    <myFields lang="en-gb">
      <Mappings mappingName="Defects">
        <ListCollection useName="true" ListName="Defects">{BFD08C83-AC9C-434E-9DB9-52367BAAAD0E}</ListCollection>
        <IsRepeating>false</IsRepeating>
        <RepeatingGroup/>
        <Relationships>
          <RelatedList />
          <RelatedListId />
        </Relationships>
        <Mapping>
          <FormField IsRichText="false" IsId="false" IsAttachment="false">my:myFields/my:Contract</FormField>
          <SharePointColumn>Contract</SharePointColumn>
        </Mapping>
        <Mapping>
          <FormField IsRichText="false" IsId="false" IsAttachment="false">my:myFields/my:FormType</FormField>
          <SharePointColumn>Trade</SharePointColumn>
        </Mapping>
        <Mapping>
          <FormField IsRichText="false" IsId="false" IsAttachment="false">my:myFields/my:Element1</FormField>
          <SharePointColumn>Element</SharePointColumn>
        </Mapping>
        <Mapping>
          <FormField IsRichText="false" IsId="false" IsAttachment="false">my:myFields/my:Element2</FormField>
          <SharePointColumn>Element</SharePointColumn>
        </Mapping>
        <Mapping>
          <FormField IsRichText="false" IsId="false" IsAttachment="false">my:myFields/my:SubElement1</FormField>
          <SharePointColumn>SubElement</SharePointColumn>
        </Mapping>
        <Mapping>
          <FormField IsRichText="false" IsId="false" IsAttachment="false">my:myFields/my:SubElement2</FormField>
          <SharePointColumn>SubElement</SharePointColumn>
        </Mapping>
        <Mapping>
          <FormField IsRichText="false" IsId="false" IsAttachment="false">my:myFields/my:Comment1</FormField>
          <SharePointColumn>Description</SharePointColumn>
        </Mapping>
        <Mapping>
          <FormField IsRichText="false" IsId="false" IsAttachment="false">my:myFields/my:Comment2</FormField>
          <SharePointColumn>Description</SharePointColumn>
        </Mapping>
        <Batch OnError="Continue">
          <Method ID="1" Cmd="New">
            <Field Name="Contract" />
            <Field Name="Trade" />
            <Field Name="Element" />
            <Field Name="Element" />
            <Field Name="SubElement" />
            <Field Name="SubElement" />
            <Field Name="Description" />
            <Field Name="Description" />
          </Method>
        </Batch>
      </Mappings>
      <SharePointListURL>https://ims.ohmg.com/defects</SharePointListURL>
    </myFields>

  • 10-04-2013 04:58 AM In reply to

    Re: Qrules - Only submit certain lines to a sharepoint list

    Hi,

    Could you also answer this one for me please.

    The form is submitting to the library and the list successfully , all be it without the filter operating yet. (as mentioned above)

    However, you can see from my mapping file above that I have a SubElement1 and and SubElement2 both mapping to the SubElement column in the list. However the column is only recording SubElement2 as that is the last entry. I have many of these SubElements in the form and they are to be brought across to the list depending on a Yes/No checkbox.

    How can I get both entries for SubElement1 and SubElement2 in the list and not just the last?

     This is not repeating table.

    Barry 

  • 10-04-2013 06:03 AM In reply to

    Re: Qrules - Only submit certain lines to a sharepoint list

    barrymurphy:
    What if its not a repeating group?

    Without a repeating group, qRules will only map ONE list item.

    If the mapping does not involve a repeating node, then qRules can't perform any filtering (because there's only one item to create, not multiple items). You could add a condition to the button in your form, so that the mapping executes only when the condition is met.

    barrymurphy:

    How can I get both entries for SubElement1 and SubElement2 in the list and not just the last?

     This is not repeating table.

    I think there are two options here:

    1. Rework your form's schema in order to have a repeating group, and map that using a filter.

    2. Have separate mapping files for each of your elements. Then each mapping file would create one item each.

    Mapping file #1 would contain:

     <Mapping>
          <FormField IsRichText="false" IsId="false" IsAttachment="false">my:myFields/my:Element1</FormField>
          <SharePointColumn>Element</SharePointColumn>
        </Mapping>
        <Mapping>
          <FormField IsRichText="false" IsId="false" IsAttachment="false">my:myFields/my:SubElement1</FormField>
          <SharePointColumn>SubElement</SharePointColumn>
        </Mapping>
        <Mapping>
          <FormField IsRichText="false" IsId="false" IsAttachment="false">my:myFields/my:Comment1</FormField>
          <SharePointColumn>Description</SharePointColumn>
        </Mapping>

    Mapping file #2 would contain:

        <Mapping>
          <FormField IsRichText="false" IsId="false" IsAttachment="false">my:myFields/my:Element2</FormField>
          <SharePointColumn>Element</SharePointColumn>
        </Mapping>
        <Mapping>
          <FormField IsRichText="false" IsId="false" IsAttachment="false">my:myFields/my:SubElement2</FormField>
          <SharePointColumn>SubElement</SharePointColumn>
        </Mapping>
        <Mapping>
          <FormField IsRichText="false" IsId="false" IsAttachment="false">my:myFields/my:Comment2</FormField>
          <SharePointColumn>Description</SharePointColumn>
        </Mapping>

    Hope this helps.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 10-04-2013 06:35 AM In reply to

    Re: Qrules - Only submit certain lines to a sharepoint list

     Thanks for that.

     I was afraid that was the answer. I need filtering and I have 100 hundred subelements so that would be 100 mapping files. Not an option.

     I would rather use a repeating group but I may need help reworking the form.

     I have a list from which the form, dependent on the form type field, pulls in elements and subelements. Its basically what was many similar forms now using one template.

    I have created 10 element fields  which have 10 subelements fields within each (so 100 subelement fields) and the form looks up a combination of the form type and the element field number to pull in the correct element from the list and same for the subelements.

     The form is basically 4 columns and and 10 rows and you will see from the rules etc what I have done. I am sure I have gone the long way around but can I use a repeating table or some other method to achieve my goal.

     See form attached.

     Barry

  • 10-04-2013 07:26 AM In reply to

    Re: Qrules - Only submit certain lines to a sharepoint list

     Hi - I am looking at your template. You definitely should be using a repeating group in this form - probably nested repeating groups. Element is the parent, then SubElement is a repeating group in that. Comment is probably a child of Element. IP is a sibling of SubElement. You may want to use more meaningful names - not sure if Element and SubElement are meaningful names for what you are doing.

    You are using default values for a lot of things. If the data changes in the source and you re-open a filled out XML, you'll find that data in the XML changes as well. You need to think about whether this is the right approach for what you are doing (it may be - if you aren't saving / re-opening the XML, this can be okay).

    Once your schema is corrected, you'll be able to map the most deeply nested repeating group and use relative XPath to get parent items as needed.

    Hilary Stoupa

  • 10-04-2013 07:41 AM In reply to

    Re: Qrules - Only submit certain lines to a sharepoint list

     Thanks for that.

    How would the nesting be represented on screen? would the visual layout be as intended in my template with say three parents and its children/siblings being visible on opening, dependent on what format has been called?

    Wouuld you have any nesting example xsns?

     I find your videos very helpful. Any on nesting and maping nested tables? 

    How do I avoid the default value?

    I think I see what you mean. You are talking about the source list I pull the data from and if it changes my saved form would change also. I believe in this instance thats ok as the paper forms were defined templates and they should not change

     Thanks again

    Barry

  • 10-04-2013 08:37 AM In reply to

    Re: Qrules - Only submit certain lines to a sharepoint list

     I'm attaching a super simple sample. I used default values to add extra instances of my repeating groups - you can use qRules to create a data driven form - try searching for that on our YouTube channel, as there may be some videos out there. Basically what you want to do is get your schema right, then you can use qRules Insert command to insert the right number of elements and subelements and add logic to populate the fields. Qdabra also sells support packs if you'd like some hands on help. :)

    Hilary Stoupa

  • 10-04-2013 08:52 AM In reply to

    Re: Qrules - Only submit certain lines to a sharepoint list

    Hilary,

    Thanks for that and many thanks for you assistance. I will look at this over the weekend.

    Have a good one

    Barry

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