Insert row on repeating tables goes wrong - InfoPath Dev
in

InfoPath Dev

Insert row on repeating tables goes wrong

Last post 04-21-2006 11:24 AM by Greg Collins. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 11-26-2004 09:25 AM

    • jonbrave
    • Top 200 Contributor
    • Joined on 10-15-2004
    • United Kingdom
    • Posts 59

    Insert row on repeating tables goes wrong

    I have 3 repeating tables bound to the same table.
    The table has 2 columns; ColumnA contains a "filter" value (3 possibilities), ColumnB contains the "data" value.
    Each of the IP repeating tables has a "Filter data" expression which looks at the "filter" value from ColumnA. So each repeating table shows just those rows appropriate to it.
    So far so good: they display right, I can delete from each one, modify etc.

    Now, I insert a row into one of the 3 repeating tables (this can be done by any of the "Insert" context menus, links, whatever). What happens? Each one of the repeating tables gains a new, blank row! (Not just the one where I have inserted the row.)

    Note that I have ensured that each repeating table correctly has its "Edit Default Values" set so that the filter value in ColumnA is set appropriately for its table whenever the user inserts a new row.

    The only way to remedy this is to right-click on (any) one of them and pick "Refresh Filter" --- then they redraw and only the table to which the new row applies (as per the filter) now has the new row.

    I don't think my users will understand this behaviour! How can one get the filter to be obeyed/reapplied automatically when a row is inserted???
  • 11-26-2004 07:08 PM In reply to

    Re: Insert row on repeating tables goes wrong

    Sorry to tell you this, I know it's dumb, but this is the expected behavior.

    You can fix the manifest.xsf file so that the filtering happens automatically (i.e. you don't have to use "refresh filter") -- but I think you'll find that worse because then the new row won't appear at all because it will be automatically filtered out!!

    For more information on automatic table filtering, please visit:
    http://www.infopathdev.com/howto/tutorials/default.aspx?i=f0916b51b9d74bda9001b9a079c5aeb9

    I know of no way to dynamically tell InfoPath to have the active table NOT autofilter, while the others do. I think you're stuck to looking into an alternate design. Sorry.

    Greg Collins [InfoPath MVP]
  • 11-29-2004 06:07 AM In reply to

    • jonbrave
    • Top 200 Contributor
    • Joined on 10-15-2004
    • United Kingdom
    • Posts 59

    Re: Insert row on repeating tables goes wrong

    Greg, thanx, as ever, for that.

    Now I'm really confused. What you've suggested does appear to work, even though you said it wouldn't! I need to understand what's going on, first off.

    Is it possible you slightly misunderstood my situation? You say:
    quote:
    but I think you'll find that worse because then the new row won't appear at all because it will be automatically filtered out!!

    and:
    quote:
    I know of no way to dynamically tell InfoPath to have the active table NOT autofilter, while the others do.


    But I don't think I've ever asked for this! Would you be kind enough to reread my description. There I said I have ensured that any new row inserted into each of the 3 repeating tables does get its filter value in ColumnA set correctly, initially & automatically (via Edit Default Values for each of the 3 tables, with a different default for each one). So it seems to me the new row will not get filtered out, nor am I asking for some tables to filter and others not. I am only asking for all tables to "auto-filter" as soon as the user inserts, right?

    I follow your suggestion of:
    quote:
    delete any attribute useFilter="yes" on an xsf:editWith element

    which, sure enough, I found on the 3 repeating tables. Now I find that when I insert a row in one table I only get the new row in that one table. I take that to mean that removing the useFilter="yes" causes the filter to be automatically applied immediately? Strange... If anything, I would have thought you would lose filtering completely.... As far as I can see, now everything works in all situations.

    Which leaves me with two questions :) :

    1. Could you please explain what useFilter="yes" does/is all about?

    2. I have my usual problem. My work is to produce "template" XSNs for end-users --- who will have different columns etc. in the db --- to use as "starting point" for customising their forms. My end users are not smart! :( I can ask them to use IP design mode fine, but extracting files and editing with an editor is precisely what we do not want! Is there anyway to get that line not to appear from IP? And/or, if I have deleted those lines from what I supply, will any new repeating tables they add in design mode auotmatically get that line back? Why do I feel I know the answer here... :)
  • 04-13-2006 06:05 AM In reply to

    Re: Insert row on repeating tables goes wrong

    I am having the same problem but the solution doesn't work. One interesting piece of information I have is that if one of the tables has at least one row, inserting a new row in any of the other tables only inserts one in that table - the others are left alone.

    This is a problem for me because one of my tables is read-only but a new row gets put in here. Users cannot submit the form because of required fields in the read-only table. They are not allowed to change this data.

    I noticed this posting is from 2004. Does InfoPath 2003 have anything that will stop the inserting of empty rows in all tables just because the user wants to insert a new row into one table?
  • 04-13-2006 10:29 AM In reply to

    Re: Insert row on repeating tables goes wrong

    If you are binding all of the tables, including the readonly table, to the same data nodes, then all tables have the same rows inserted. Keep in mind that the tables are only visual representations of the data. There is only one set of data, and say 3 tables (as was the case in the original post).

    Does this answer your question? If not, please describe your scenario in more detail. Thanks.
  • 04-13-2006 02:04 PM In reply to

    Re: Insert row on repeating tables goes wrong

    I will explain my problem in more detail:

    I have a main data connection to a table of employees in a database. Each employee has an EmployeeID. I added a 2nd table to the main data connection. This table is a list of Tasks Accomplished identified by an EmployeeID and a date (the other fields are not important). I added another table of Tasks Forecasted - each of which is also identified by an EmployeeID and a date. The final table added to the connection is for Requests. Each request includes an EmployeeID for the employee assigned to fulfill the request. So, the main thread between all 4 tables is the Employee even though the data is maintained within the database in separate tables.

    At the top of the form is a drop-down list where an employee is selected. This is linked to the EmployeeID queryField in the employee table. When a selection is made, I issue the thisXDocument.Query() function. There is also a date selector on the form which when modified also invokes the Query function.

    The form includes a repeating table for the tasks accomplished; a repeating table for the tasks forecasted; and a read-only table of the assigned requests. These 3 tables are populated when the Query is performed. The 2 task tables are filtered using the date selector value.

    Now, if all 3 tables are empty (meaning there isn't any data for that employee on the specified date) and the employee asks to insert a new Task Accomplished, a new row is inserted into that repeating table on the form. In addition, a new row is inserted into the Tasks Forecasted and the assigned Requests tables. This is the problem. Not only is this not what you would expect but the user can't delete this bogus row in the read-only assigned Request table.

    If, however, there is at least one task accomplished or one task forecasted or one assigned request when he asks to insert a Task Accomplished, there is only one new row inserted in the Task Accomplished table and the other 2 tables remain unchanged. This is totally what I would expect.

    I have this downsized to a small project using Visual Studio 2005 and a small MS Access database. If necessary, I could send it to you.

    Thanks for your help Greg.
  • 04-13-2006 04:58 PM In reply to

    Re: Insert row on repeating tables goes wrong

    From your description, I can understand what is happening, but don't know enough about the form to be able to give any idea what might be the cause. So it would be helpful if you could send the sample (make sure you remove anything that would be considered proprietary that I shouldn't be seeing, if anything). You can click on my name on in the left column here, and then email me from the link in the profile page.

    I have VS2005 installed, but haven't tried using it with InfoPath yet, so if I might need to contact you about making sure the environment is set up properly--unless VS2003 would work just as well.
  • 04-13-2006 05:43 PM In reply to

    Re: Insert row on repeating tables goes wrong

    Greg,
    There isn't any contact information in your profile. You can send me your e-mail. I am pretty sure my e-mail is in my profile.
    Laurie
  • 04-19-2006 11:00 PM In reply to

    Re: Insert row on repeating tables goes wrong

    Hi Laurie,
    There is a Submit Project Inquiry link on our About Us page. Thanks!
    Patrick Halstead
    Project Manager at Qdabra
  • 04-21-2006 11:24 AM In reply to

    Re: Insert row on repeating tables goes wrong

    I reviewed your form. The problem is that of context. It emanates from the manifest.xsf file, but the problem was created in how you built the view. I won't get into details because it would take too long to explain.

    Here's what you need to do to manually fix the issue:

    1. Immediately following the first repeating table (in the same layout
    cell) insert a repeating group for the d:COE_Employee node.

    2. Double-click the new section and disable inserting. Then set the padding and margins to zero. You should also remove the default 1pt white border from the new section.

    3. Copy the new section and paste a copy of it into the same location for each of the other 2 repeating tables.

    4. Cut & Paste each repeating table into their associated repeating section.

    What this does is to change the context of the table to it's parent node instead of to the root node. This context change prevents the form from thinking it needs to insert each row the first time (though I still don't know why it thought it needed to because the manifest looked like it had the right data and context in it).

    Anyway--this should fix the issue. Keep the solution in mind for future work you do.

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