Create two data row in one datacollection by one owner (ID)

Hi, Good day everyone, I want to achieve two data row in one datacollection(redog) by one owner (ID), for example, a dog registry form, if the customer already registered a dog and want to add another dog but the dog will go to the another row in the same datacollection(redog). Is this doable? I really need this, please help, I’m stuck, can’t move on.

what is the problem?

1 Like

Hi Andreas,

Good day from the other side,
Thank you for the response!

I don’t have a code yet, just gathering information, for a multiple data row for one owner (ID) in the same datacollection, cause right now I’m doing a service dog registry. If the disabled dog handler have a multiple dogs she/he can register it into the website. Please see the URL —> https://evanrjenkins.wixsite.com/dogservice
Any suggestions are welcome.
Thank you,
Geo

1 Like

I want something like the example table below

±----±-----+
| ID | Item
±----±-----+
| 001 | A
±-----±-----+
| 001 | B
±-----±-----+
| 002 | C
±-----±-----+
| 002 | D
±-----±-----+

2 Likes

Is this doable Andreas, any idea ? I really need this one.

1 Like

Hi Geo,

To be honest, I’m not sure what the problem is…

From what I understand, you want to be able to have more than one dog registered under one owner. All that means is that each dog gets a row, and has the owner (ID) as a column.

What am I missing?

Yisrael

1 Like

If you don’t add some verification code the users can add how many rows they want (dogs) so I guess it will be up to you how to code the solution. If you just want them to be able to add two dogs you will have to do a query before inserting a new one to check how many already exists.

2 Likes

And: The unique ID in this collection should be for the dog since the owner IDs might appear more than once.

1 Like

Yes your Correct Yisrael , I want to be able to have more than one dog registered under one owner. All that means is that each dog gets a row, and have a same ID (So the registered dogs will display on a repeater) in the column. Any Idea how to start that code to achieve my goal? :slight_smile:

And I already manage to create a unique IDs for each every dog registered on my website, my only problem is what if the dog handler want to add two or more service dog, how can I store them and display it in repeater, so I come up with the same _id in the same data collection so it’s easy for me to handle their information.

I just want to put a limit of 5 dogs per owner, is this doable Andreas ?

1 Like

After the customer registered the first dog, the page will automatically go to the registered dog page (A dynamic page with repeater elements where displays how many dog the owner registered)


And if the customer want to add another service dog, click the “Add Service Dog” button and it will g to the add dog page.

and the data will go to the same Database with the same ID if it’s possible and a limit of five dogs per owner. is this doable? Thank you !

1 Like

Geo,

“Add Service Dog” button should be hidden by default and made visible within $w.ready block that checks if the current owner has up to 4 existing dogs.
later you should also add a backend validation as well, but please let me know if hidden/visible button works for you

Shlomi

1 Like

Hi Shlomi,

Good morning.
Good to hear you again.
My problem is, I can’t start the code yet, I don’t have any idea how to start it. I hope you can provide a code to start. Thank you Shlomi :smiley:

Best regards,
Geo

2 Likes

Hey Geo,

I’d love to help, what do you mean by ‘code to start’? What is the first step?

Ill also take a look at your site, thought you need help with the number of dogs limit

Shlomi

1 Like

Hi Shlomi ,

Good to hear you again.
Yes, what is the first step. How to start the the adding the second dog.

Geo

1 Like

Geo,

looking deeper into your site,

  1. the first step is to model the dog owner collection and its attributes
    id, name, social_security_number, address etc

  2. the the dog collection
    id, name, owner (of type reference)

  3. create a page to display/search dog owners. it will typically be a Gallery or repeater in this page add a button to add/register a new dog owner. on the repeater with a click you will be redirected to a dynamic page of a dog owner to display the details and possibly edit if needed (lets postpone this part)

  4. in the dynamic page (3) of the owner display another gallery/repeater of the dogs owned by the current owner, again here add a button to add another dog, click on a specific dog will redirect to a dog dynamic page

please keep us posted with how it is working for you :wink:
Shlomi

1 Like

Hello Geo …

This is Nayeli … interrupting …

I think you are over thinking what you need to do and how you are asking it.

  • Owner fills in registration form
  • Dog is saved on public database
  • You want to display all the entries made by owner ONLY on his own profile page
  • You want to limit 5 entries only

So what you are looking for is a code that displays owner of entry and a code to limit entries.

Have you seen my wish list video? It has the same functionality you need.

1 Like

Hi Shlomi,

Thank you for the help Shlomi!

I already created that function, the only thing that keep me stuck is the how to add dog into the same owner and display it on a dynamic page with a repeater element along with the dog the owner register first. :slight_smile:

Thank you for the suggestion Nayeli , it’s a big help. I really appreciated it :slight_smile:

Hi Geo,

i really want to help you more, could you please share your email so i can contact you in private?

thanks,
Shlomi

Good morning Shlomi,

That would be a great idea.
geovelx@gmail.com

Thank you,
Geo

Shlomi ,

Now I get you, just like the Wix content example ‘Review’ —> https://www.wix.com/code/home/example/Reviews

1 Like