Title: Relation Field Problem
Last modified: February 6, 2019

---

# Relation Field Problem

 *  Resolved [esinformatica](https://wordpress.org/support/users/esinformatica/)
 * (@esinformatica)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/relation-field-problem/)
 * First of all, congratulations for the very valid plugin and **thanks Jim True**
   for the great work and support you’re giving for this plugin.
    This is the first
   time I use pods, and I’m finding it very interesting, but unfortunately, like
   all new things I’m finding it difficult.
 * I am making a very simple project and it consists in creating a simple “Archive”
   compiled of the visits list that I have in the company by the various customers.
   
   The structure is very simple and I created 3 New Post Type Content
 * 1 – **Companies List**
    Fields: Company name Address Phone
 * 2 – **List of Users**
    Fields: Username Rif_Company -> from Companies List
 * 3 – **Users Visits List**
    Fields: Date_Visit Username_Visit -> from the User
   List Rif_Company_Visit -> from the User List (AutoCompiled)
 * The population of “Table 3” should do it through Gravity forms (im using the 
   addon for pods ) where only with automatic selection of the customer’s name should
   fill in the company field previously assigned in table 2.
 * The problem on which I am stuck is the following:
 * When I try to **relate the field Username_Visit with Username** of the table ”
   List of Users” does not come out and tells me that there is no related field,
   the same thing is for the company field. 
 * Thank you very much to those who will give me a hand for this little project!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Contributor [Jim True](https://wordpress.org/support/users/jimtrue/)
 * (@jimtrue)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/relation-field-problem/#post-11184325)
 * If you have the Company being populated/linked from the Users (ie Users are assigned
   to companies), you don’t need to include it in your Users Visits relationship
   as the source of it is the ‘user’ post type. You’re repeating yourself trying
   to include it in that ‘Users Visits’ Post Type.
 * If you can’t populate Users Visits Lists from the ‘back-end’ admin, you won’t
   be able to do it using the Pods Gravity Forms Add-on, either, since you’ll be
   populating that Post Type with the Gravity Form and connecting the Feed requires
   that. I can pretty much verify you can’t pull the linked company from the user
   into the User Visits form because that’s not the source of that connection.
 * You’re wanting Gravity Forms to provide a ‘dynamic’ lookup to show the Company
   for the user and that’s not going to work because Users owns that connection.
   That is not what the Dynamic Population of the Selection Lists handles; it loads
   the relationship field from your Post Type only. It can’t do ‘lookup’ against
   another field for a value to match that it doesn’t have access to.
 * It’s fun when ‘simple’ things aren’t really ‘simple’, huh? 😉
 * Suggestion: If you’re really just needing to track the User Visit, if they’re
   not IN the selection list, you want to branch to a form to Add the User and select
   the Company (subsequently if the company doesn’t exist, you want to branch to
   a form to add the Company). Then your visit is really just searching for the 
   User and tracking their visit. The company is tied to the User, so for displaying
   that archive, you’d loop through User Visits, Display each User and display the
   Company connected to the User linked through that relationship field in Users.
 * Does that make more sense?
 * Relationships in Pods don’t work against specific fields; they are connections
   to specific posts in other Post Types. So your connection in List of Users to
   RIF_Company is a direct relationship to the Companies post type.
 * Bidrectional relationships require there to be connected relationship fields:
 * ie Users Visits > List of Users and List of Users > User Visits, so if you wanted
   that bidirectional connection created, you would need a relationship field in
   List of Users called ‘Visit Log’ that was a relationship to ‘User Visits List’
   and was ‘multiple select’. Once you created that field, you could create the 
   bidirectional connection inside User Visits List.
 * You don’t have a connection from Users Visits to Companies. The connection is
   Users to Companies, so you can’t make a relationship there, especially if the
   actual ‘ownership’ of that relationship is Users (since that’s where you’re tracking
   the company connection to the users).
 *  Plugin Contributor [Jim True](https://wordpress.org/support/users/jimtrue/)
 * (@jimtrue)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/relation-field-problem/#post-11184329)
 * Also, if you need more help figuring this out, please feel free to join our Slack
   Chat at [https://pods.io/chat/](https://pods.io/chat/) in the #support channel.
 *  Thread Starter [esinformatica](https://wordpress.org/support/users/esinformatica/)
 * (@esinformatica)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/relation-field-problem/#post-11196294)
 * Thanks Jim for the long and exhaustive answer.
 * As for the “User Visits” table, I had to create it separately because I will 
   have to create another Post Type that will be the contact person in the company
   to to assign on the visit!
 * As for the use of Gravity Form, it will only be for entering user data. So the
   customer will fill out independently his personal information and populate the
   customer data table.
 * I’m at the end! My final point now is to be able to create a small summary table
   with the three post types above in relation
 * Ex.
    Username – Visit Date – Company
 * I’m finding it difficult to find some examples from which to take a cue to create
   this summary table.
    Do I have to do a query whit multiple post type to do this?
   Do you know where I can maybe find some simple examples?
 * Thank you very much for your availability
 *  Plugin Contributor [Jim True](https://wordpress.org/support/users/jimtrue/)
 * (@jimtrue)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/relation-field-problem/#post-11218490)
 * Well, your ‘visits’ is the primary post type in this situation (the one that 
   contains all the related information).
 * So assuming you have a relationship field from `visits` to `user` (I’m calling
   it `related_users`) and `user` is linked to `company` with `related_company`,
   you’d do it pretty much like this:
 * `[pods name="visits" limit="-1" template="User Visits"]`
 * With “User Visits” template looking like this:
 * \`
    [before] <table> <thead> <tr> <th>User Name</th> <th>Visit Date</th> <th>
   Company</th> </tr> </thead> <tbody> [/before] <tr> <th>{@related_user.display_name}
   </th> <th>{@visit_date}</th> <th>{@related_user.related_company.post_title}</
   th> </tr> [after] </tbody> </table> [/after] `
 * Hope that helps. 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Relation Field Problem’ is closed to new replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Jim True](https://wordpress.org/support/users/jimtrue/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/relation-field-problem/#post-11218490)
 * Status: resolved