Complex Repeating List Validation (well it is for me...) - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Complex Repeating List Validation (well it is for me...)

Last post 09-26-2011 01:38 AM by SimpsonB. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 09-16-2011 07:35 AM

    Complex Repeating List Validation (well it is for me...)

    Hi Everyone, 

     It has been a bit of time between posts for me, but since the expertise was so great last time I thought I would try again.

     Firstly a bit of background info. The client is using Infopath 2003 and the form I have to modify is in production already so I am unable to modify the XSD template. I had fixed my problem by adding one simple node but unfortunately this breaks all the forms created thus far :(

     Anyway, onto the problem at hand. Within the form we have a repeating list, I will call this AAA. Within AAA there are another two repeating dropdown lists. Lets call them BBB and CCC. Now, the client wants the following validation to occur - 

    * When the form is opened for the first time BBB and CCC must both be mandatory
    * If a value is selected in BBB make the dropdown list of CCC optional (red asterisk to disappear).
    * Likewise, if a value is selected in CCC make the dropdown list of BBB optional (red asterisk to disappear).
    * Each instance of AAA must validate BBB and CCC as outlined above

    The above validation is to also occur when another repetition of BBB or CCC is inserted. So the first record may be blank and a item is selected in the second dropdown list.

     I have tried using "sum" to add up the nodes of each repeating list BBB and CCC but have not been able to get it to function correctly (obviously why I am asking on here....). I am not 100% sure why though as when debugging my validation using expression boxes it seems to work as intended. Eg, I placed the expression box with the repeating section of BBB the tried "sum(../../ns1:BBB/ns1:node)", when blank this returned 0 or when a value was inserted it would sum the ID of the dropdown list. The figure would be irrelevant as I was just after if it was greater than zero (ie an entry had been chosen).

    Another thought I had was, my validation my night be occurring as I am attempting to sum up blank / null values and possibly I am not comparing them correctly????

    So that is my problem, hopefully some with more knowledge than me could point me in the right direct. I would be muchly appreciated.

     Thanks In Advance, 

    Brett from Qld Aust :)

  • 09-16-2011 08:39 AM In reply to

    Re: Complex Repeating List Validation (well it is for me...)

    Hey Brett,

    So here is the logic that I'm pulling from your post.

    Both need to start out as mandatory fields. This is done using data validation on BBB and CCC that say these drop downs cannot be blank.

    Now to make sure the asterisk dissapears after selecting one or the other, you will have to add some more logic onto each of those validations.

    You would add the same data validation to both dropdowns, they would look something like this:

    BBB is blank AND CCC is blank.

    I just tried this and it works so you should be good to go for that. Now about your "sum" that you are trying to find. Could you go into a bit more detail of what that is exactly used for, I was a little confused by your post.

  • 09-16-2011 01:38 PM In reply to

    Re: Complex Repeating List Validation (well it is for me...)

    Lockdown:

    I just tried this and it works so you should be good to go for that. Now about your "sum" that you are trying to find. Could you go into a bit more detail of what that is exactly used for, I was a little confused by your post.

     

    Hi Lockdown,

     Thanks for your reply. I have tried the "is blank" option for BBB and CCC but I found that the validation need to be more complex than that unfortunately due to this situation -

    The form is loaded. The user then clicks on the "insert new record" for BBB (or CCC). They then change this newly inserted record to a value. 

    In my testing the validation still shows the asterisks on the first records of BBB and CCC as the "is blank" seems to only worry about the first record hence why I was trying to use the "sum" function.

     I know the "sum" function will sum the IDs of the dropdown list which sounds useless (the ids are like 22,23,24 etc) but I thought if the "sum" is greater than zero it must mean a record has been selected in the dropdown list no matter what position or how many blank records have been inserted by the user.

    That was what I was hoping to use the "sum" function for. It doesn't need to be used as I may be on the wrong track......

    Cheers

    Brett 

  • 09-16-2011 01:45 PM In reply to

    Re: Complex Repeating List Validation (well it is for me...)

    Would you mind attaching your form template so I could take a look. I'm still a bit confused by what exactly you are trying to do.

    EDIT: Also, make sure you are putting BBB is blank and CCC is blank on both of your drop down lists.

    Dropdown list BBB: BBB is blank and CCC is blank

    Dropdown list CCC: BBB is blank and CCC is blank

  • 09-16-2011 01:55 PM In reply to

    Re: Complex Repeating List Validation (well it is for me...)

     Sorry Lockdown, due to the nature of the work I am unable to do that. I am going into work later this morning so I will try and take some screen shots or make a dummy template which may help.

    Did you try adding a new record with your validation and did the all asterisks disappear? 

    I will try your validation when at work but I am pretty sure I have tried that and the client wasn't happy when performing the set of instructions in my second reply :( Bugger.....

  • 09-16-2011 02:43 PM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

    Re: Complex Repeating List Validation (well it is for me...)

     Does this sample help?

  • 09-16-2011 05:20 PM In reply to

    Re: Complex Repeating List Validation (well it is for me...)

    Hi Skarn,

    Thanks for replying :)

    Here is a dummy template which is how the current form is setup.

    What I am trying to achieve is that when the form loads COL1 for both BBB and CCC is mandatory.
    Once selecting a value in BBB col 1 then CCC col1 is not mandatory anymore (and vice versa).

    The user may not necessarily select a value from COL1 ROW1. They may insert a blank row then select a value from that.

     Hope this helps...... as I need it.

     Cheers

    Brett

  • 09-16-2011 10:31 PM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

    Re: Complex Repeating List Validation (well it is for me...)

    I made a change to your structure to demonstrate a way I handle 'Other' requirements of a field sometimes.

    It also simplified the data validation needed as bit.

    I believe this does what you want, however, I suspect that your datasource structure may be more complicated than it needs to be, but that would depend on the rest of the form and what happens to the data after the form is submitted, which we cannot see.

  • 09-26-2011 01:38 AM In reply to

    Re: Complex Repeating List Validation (well it is for me...)

     I forgot to reply earlier but Skarn, your code worked a treat.

     Thanks very much!

    Turns out it wasn't as complex as I thought. That and summing up in validation seems a no go.......

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