Two data sources, repeating table in repeating section, trying to do conditional formatting - InfoPath Dev
in

InfoPath Dev

Two data sources, repeating table in repeating section, trying to do conditional formatting

Last post 09-08-2011 10:35 AM by Rae. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 09-08-2011 05:50 AM

    • Rae
    • Not Ranked
      Female
    • Joined on 08-31-2011
    • Posts 20

    Two data sources, repeating table in repeating section, trying to do conditional formatting

    So, I have a repeating table in a repeating section. The repeating section has some stuff from the main data source in it. The repeating table receives data from a SQL database.

    I'm trying to use conditional formatting on the table to hide rows based on a value in the main data source. Every instance of the repeating section should have a unique repeating table in it (unless, of course, the same reference value is entered in more than one instance of the section).

    Right now, I've tried "if valueB does not equal valueA, hide this control." The problem is if I insert an item to the repeating section, both versions of the reference value have to be the same for it to count it as equal, AND it copies the same repeating table into the other instance of the section.

    However, every attempt I've made so far at using "current()" has only made it so that ALL results from the SQL database show up in the table in all instances of the repeating section, no matter what. I think I've tried all the usual stuff, but I could be totally off. I tried using "parent::" once or twice, but I just confused myself further.

    The main data source looks like this:

    myFields
    -group1
    --group2 (repeating section)
    ---valueA (reference value)
    ---valueX
    ---valueY
    ---valueZ

    The secondary (SQL) source looks like this:

    myFields
    -dataFields
    --d:testMatrix (repeating table)
    ---valueB (value being compared to ref value)
    ---valueQ
    ---valueR
    ---valueS

    Let me know if I need to provide any additional information.

    Thanks!

    P.S. This is IP 2003.

  • 09-08-2011 07:52 AM In reply to

    Re: Two data sources, repeating table in repeating section, trying to do conditional formatting

    This seems to be a popular question lately:

    Linking Two Repeating groups....

    You need to use the filtering in the repeating table's property dialog, and not conditional formatting.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-08-2011 08:30 AM In reply to

    • Rae
    • Not Ranked
      Female
    • Joined on 08-31-2011
    • Posts 20

    Re: Two data sources, repeating table in repeating section, trying to do conditional formatting

    I actually asked a similar question (why it said "data cannot repeat here" when I put the table in the section) and you responded with that link, but I don't see filtering in the properties box anywhere. I didn't think it was possible to filter repeating data from a secondary data source? So I've been trying conditional formatting, and I'm fairly certain I tried the use of current() that's shown in that link - along with just about everything else I could imagine.

    (I made a new thread because I figured my first question had been answered and I was on to something separate.)

  • 09-08-2011 10:15 AM In reply to

    Re: Two data sources, repeating table in repeating section, trying to do conditional formatting

    You'll have to pardon me.  First for not realizing that other thread was also you, and second for assuming you could filter a table bound to a secondary data source.

    Unfortunately, I don't believe conditional formatting is going to work here, because in conditional formatting on a repeating table, current() refers to each individual row of the table itself (i.e. the rows of the inner table), and there is no way to get at the values of the containing section.

    Alas, I can only think of two possible approaches to this problem.

    1. Copy the data from this secondary data source into your main data source, and use the technique described in my link.  This can be achieved fairly easily using qRules, but might be an issue if the amount of data in your secondary source is large, or if you don't want to have this secondary data in your main data source, which would be a valid concern.
    2. Use a Preserve Code Block. This is an advanced technique that involves manually modifying the XSL for your view, and has a few drawbacks in that you can't use the InfoPath designer to modify (or even see) the affected portion of the form (the inner repeating table).  Nonetheless, I'd be happy to show you how to do this if you'd provide me with a copy of your form.
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-08-2011 10:35 AM In reply to

    • Rae
    • Not Ranked
      Female
    • Joined on 08-31-2011
    • Posts 20

    Re: Two data sources, repeating table in repeating section, trying to do conditional formatting

    I only added a photo and a display name today, so I understand the confusion :)

    Those approaches sound...frustrating. Haha. Part of the issue is I need to keep this as simple as possible, because I'm supposed to be passing the how-to-make-forms-work information on to a non-programmer, and while this is getting less and less plausible, I'm still trying to hang onto that if I can.

    I did just come up with one solution for my particular situation. I was taking a fairly convoluted approach to dealing with this form. This form has a button that opens up another form, in which a repeating table resides, which can be filled and submitted to a SQL database. Then it closes, and the user can (theoretically) query the database to refresh that list, so it's visible on the main form (in case the user wants to print all the data together). For reasons I cannot currently remember, this seemed to be the only way to deal with the data. I got stuck in actually making the proper data visible in the table, because it is also in a repeating section and that just throws everything off.

    What I've found is that simply defining two tables in the database and using a one-to-many relationship works beautifully. I made a new form based on the data connection, and so far it formats and submits perfectly fine, effectively throwing all my other problems away. I should have tried this sooner.

    Thank you so much for your time!

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