qRules FilterOwssvr to filter a semi-colon delimited field in a list for use in populating a drop-down? - InfoPath Dev
in

InfoPath Dev

qRules FilterOwssvr to filter a semi-colon delimited field in a list for use in populating a drop-down?

Last post 02-14-2011 11:00 AM by kbailey. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 02-14-2011 06:15 AM

    qRules FilterOwssvr to filter a semi-colon delimited field in a list for use in populating a drop-down?

    Dear InfoPath Dev gurus,

     I am modifying the meeting notes InfoPath template to make it more interactive and to pull pre-populated information in to hopefully make it faster to fill out. For taking attendance, I want to create a custom sharepoint list with meeting names and semi-colon delimited lists of invitees, then have my form query that list, parse the list of invitees and use that list to populate a repeating table where my meeting organizers can then record attendance.I found the delimited rule in qRules but that seems to do the opposite of what I'm trying to achieve - take rows of data and create a delimited list. I want to take a delimited list and populate rows of data. I saw that FilterOwssvr has a delimited switch, but I'm not sure whether it can be used to accomplish what I need. I consulted the PDF documentation but didn't find any detail on using the delimited switch. Any help you can give would be terrific. Thanks!

    Kevin

  • 02-14-2011 07:44 AM In reply to

    Re: qRules FilterOwssvr to filter a semi-colon delimited field in a list for use in populating a drop-down?

    Ok, suppose your main data source was structured like this:

    myFields

      L  attendees

           L  attendee (repeating)

                  L name (string)

                  L attended (boolean)

    And let's call the field where the semicolon delimited names are "nameList"

    When you want to populate the list, you send this command to qRules:

    concat("Insert /parent=/my:myFields/my:attendees /child=my:attendee /count=', string-length(nameList) - string-length(translate(nameList, ';', '')) + 1)

    This string-length(nameList) - string-length(translate(nameList, ';', '')) + 1 part here is a trick to count the number of semicolon-separated segments in the field value.

    Then on the attendee field, you add the following rules:

    Rule1 - condition: nameList contains ;

    Set name to substring-before(nameList, ';')

    Set nameList to substring-after(nameList, ';')

    Rule 2 - condition: nameList does not contain ;

    Set name to nameList

    As rows are added to the table, rule 1 will slowly chip away at nameList, removing the first part, and leaving the remaining part.  Then when there is only one remaining part and the final row is added, rule 2 kicks in to assign the remainder to the name field.

    Could you give that a try?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 02-14-2011 09:00 AM In reply to

    Re: qRules FilterOwssvr to filter a semi-colon delimited field in a list for use in populating a drop-down?

     Thanks for this Jimmy. I got the insert command to work but have to run to a few meetings -  when I get back I will try the rest. I really appreciate the help!

  • 02-14-2011 10:16 AM In reply to

    Re: qRules FilterOwssvr to filter a semi-colon delimited field in a list for use in populating a drop-down?

     Hi, Jimmy. I tried this and here is what I got:

     The insert command results in 1 row being added regardless of the length of the namesList string and regardless of the number of semicolons present.  This leads me to think that the count provided by  string-length(translate(@Invitees, ";", ",")) is the length of the entire string, not the count of number of occurrences of the delimiter. So the  string-length(@Invitees) - string-length(translate(@Invitees, ";", ",")) + 1) section results in a value of 1, regardless of input.

    The rules on the attendee node work well - if I change '1' in the function above to '6' i get six distinct names.

    Any other ideas how I might accomplish this?

    Thanks,

    Kevin

  • 02-14-2011 10:28 AM In reply to

    Re: qRules FilterOwssvr to filter a semi-colon delimited field in a list for use in populating a drop-down?

    You have a comma between the last pair of quotes, but there shouldn't be anything between them.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 02-14-2011 11:00 AM In reply to

    Re: qRules FilterOwssvr to filter a semi-colon delimited field in a list for use in populating a drop-down?

     Thanks, Jimmy. I fixed that and I modified the second rule that checks to see if the NameList is missing the delimiter to add a condition to check to see if the Name field is empty. Without that the second rule was populating the last two rows instead of only the last row.

    Thanks again - I think my form is now ready to be published!

    Kevin

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