(solved) Confused about parent group

Hola folks,

I am probably not thinking right. Here is my scenario.

I have one data type called listing. I have two users signed up and they have successfully created two separate listings. Field created by user includes, "first name’, ‘Description’ etc.

Now I am trying to create an edit form, so they can edit their listings.

I used a group element and used content type as ‘listing’, then I drew input elements and created a simple form. For the group data source, I used 'Search for listing"

Now when I go to an input element to populate it with ‘Initial content’. I used option as ‘Current cells listing’s first name’.

Of course on preview, it is showing the first item on the database. It is not show first name which belongs to the user who entered it.

My objective is to retrieve data that belongs to the user who created it and populate the input fields, this way user can see what he entered previously and edit it.

I initially, thought, I would get an option like ‘Current users…’ Current user option only shows me registration related stuff. I want to get data from Listing database and populate it on the ‘Initial content’ field.

Hope I did not sound confusing.

Many thanks in advance folks

Cheers

2 Likes

Have a field in the listing type called “user” and make it type user. When a user creates a new listing, set that field to be the current user. Then, in your group, only display the listing created by the user (the source is still a search for listings, but set a constraint to only look for listings whose user is the current user). If you anticipate users to be creating more than one listing, then you’ll need to play around with a repeating group with the same source setting. Does this help?

As I type this, I also realized that your constraint can just be the “created by” field that is automatically created whenever a new data entry is created. You have more control by adding another user field yourself, but from what you described, that may actually be all you need. So your constraint on the search would be “created by = current user” where the created by field is already built in and you wouldn’t need to add a new field to the listing data type. I may have over-explained this…haha, let me know if you still need help.

2 Likes

Wow, it works. Now I have a better understanding. I have always been trying to figure this and tried various examples. Creating a field type user was the key. I assumed creator field took care of that. Many thanks, I feel like a pro right now lol lol

(For newbees like me trying to understand)
This time on a new listing page, I added user = current user while saving the form and on the view page, I put content type listing and in the data source, I put a constraint to user = current user. So my data source looked like “Search for listing:first item” Of course it has a constraint in it to search for current user. Then in the input element, I used “Parent group’s listing’s first_name” for the initial content. Now when my own opens the edit form, the fields are populated with what the user used initially while listing.

3 Likes