One Form viewing Two Lists Relationally - InfoPath Dev
in

InfoPath Dev

One Form viewing Two Lists Relationally

Last post 05-19-2014 06:33 AM by EArgen. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 05-13-2014 07:52 AM

    • EArgen
    • Not Ranked
    • Joined on 05-13-2014
    • Posts 5

    One Form viewing Two Lists Relationally

    Hi everyone, I am new to InfoPath and this is probably a very simple thing to do, but I just can't seem to get it to work. For reference I am using SharePoint 2013 along with InfoPath 2013.

     

    My question is this:

     

    I have a list A that has basic employee information (EMP ID, First Name, Last Name) and list B that has basic address information (Address ID, EMP ID FK, Address, City, State, ZIP). The 'EMP ID FK' is the foreign key I am using from List A to form the relationship between the lists.

     

    In InfoPath, I want to be able to list out this information in a row with split columns, so you can see all of the information like this (EMP ID, First Name, Last Name, Address, City, State, ZIP), for however many people there are in the system. I can get the repeating part to work, I make the data connection and just click and drag over. But I don't know how to match the information. I want EMP ID 1 to be matched with EMP ID FK 1, and EMP ID 3 to be matched with EMP ID FK 3.

     

    I have tried 'hiding' the control if EMP ID does not equal EMP ID FK, but that just hides the control entirely, not what I'm looking for.

     

    Am I just going about this the wrong way or is this more complicated than I think it is? I would prefer a codeless solution, but am willing to work with code if you are kind enough to explain it.

     

    Thanks for your help! 

  • 05-15-2014 08:15 PM In reply to

    Re: One Form viewing Two Lists Relationally

    Hi EArgen, Did you create fields in your main data source? You can create fields in your main data source and get the values from your secondary data source List A and then display the correct values from List B using filters. Let me know if this works or if you need more help. Jun
  • 05-16-2014 01:49 PM In reply to

    • EArgen
    • Not Ranked
    • Joined on 05-13-2014
    • Posts 5

    Re: One Form viewing Two Lists Relationally

     

    jun_barbosa:
    Hi EArgen, Did you create fields in your main data source? You can create fields in your main data source and get the values from your secondary data source List A and then display the correct values from List B using filters. Let me know if this works or if you need more help. Jun

     

     

    jun_barbosa:
    Hi EArgen, Did you create fields in your main data source? You can create fields in your main data source and get the values from your secondary data source List A and then display the correct values from List B using filters. Let me know if this works or if you need more help. Jun

     I think it has to do with the way I want the data to look.

     Basically I have the following from table A and table B, all fields are repeating so they go like this:

    FirstName -- Last Name -- Address -- City -- State

    A1                       A1              B1            B1         B1

    A2                       A2              B2            B2         B2 

    A3                       A3              B3            B3         B3 

     

    However, if the second table doesn't have information in it for someone, that row disappears.

     

    FirstName -- Last Name -- Address -- City -- State

    A1                       A1              B1            B1         B1

    A2                       A2              B2            B2         B2 

    A3                       A3              Missing!

     

    Worse yet, if a fourth person is added, their address info is where the last person's address info should be:

     

    FirstName -- Last Name -- Address -- City -- State

    A1                       A1              B1            B1         B1

    A2                       A2              B2            B2         B2 

    A3                       A3              B4            B4         B4 

     A4                      A4

     

    So now not only can I not see where person 3's information is, I can mistake person 4's info for theirs. I feel like this is a very basic fix but I can't for the life of me figure it out. The same happens with non-repeating tables, except that when the person is missing all info from the second table it's simply greyed out and I can't alter it at all. 

  • 05-19-2014 06:33 AM In reply to

    • EArgen
    • Not Ranked
    • Joined on 05-13-2014
    • Posts 5

    Re: One Form viewing Two Lists Relationally

    So I figured out how to make it not appear missing. It had to do with the way my tables were set up. I had an Address ID with Identity as the Primary Key.

     Instead I changed it to EMP_IDFK without identity, and used it as a foreign key to the first table's primary key. This allows it to generate in the correct order and show if there is missing data.

     

    HOWEVER

     

    When there IS missing data, for example if B3 was never added to the system, I still cannot edit those fields. Once I figure out how to do that, or if anyone can help figure that part out, I think I'll be set.

     As a note, I do not have a web service set up just yet, I'm only querying directly to the SQL Server just to try and get things to work. I don't know if that would fix the problem of editing that field or not, but as it is I can edit the other fields just fine (just can't submit obviously.) 

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