How to save a tag uniquely in the database?

Hi,

I am creating a social network for readers. In this, I am allowing users to tag a book or a link along with the post they are creating.

Users can add a link which gets saved under the data type ‘links’:

But I want to allow users to add link only once. Right now even if the link is already present, it gets saved multiple times as seen in the screenshot (the youtube link)

This is how it shows in front end:

Please help!

Hey @harshala,

I’m not sure I fully understand exactly what you’re trying to do, but it seems like this might be an issue with how you’re structuring your database? It seems like you’d want the list of links to be associated with either books or post in your db? (So you’d have a field like “Links” as a “list of texts” in your “Books” or “Posts” type. Again, it’s hard for me to say because I’m not sure what you’re going for.
Alternatively, if you just don’t want to show entries that are the same in your repeating group, you could use the command “:unique elements” on your list to remove all double items from the list. Hope this helps.

This is what I want to do:

It’s a social network for readers where people can create posts and talk about books or article links they liked. In these posts, they can tag an book or the link they are talking about.

They can search for the book when they click ‘tag a book’ which is using Google book’s DB. When they get the book of the choice, the Google book link should get saved in the Data type books.

For links, they can click on ‘Tag a link’ which has to get saved as a link. The link part gets saved, but not uniquely as shown in the previous comment screenshot.

When they are tagging the link or book, it has to get saved in the database uniquely. This is because I also want to count the number of times a book or article has been tagged. The concept similar to hashtags. Here, the book or the article act like hashtags.

This is how my DB currently looks like:




please ignore the ‘reco’ed read’ for now.

Okay, I think I know what you’re going for.

I would set it up like this (and I’ll only include the relevant types and fields for this example):

Type: Post

taggedBook --> of the type “Book”
taggedLink --> of the type “Link”

Type: Link

link --> of the type text

Type: Book

bookTitle --> of the type text

You could also add a field that is of the type “list of Posts” to both the “Link” type and the “Book” type if you wanted to keep track of the number of posts a certain tag was used in. Hope this helps!

Thank you so much!

For the ‘list of posts’ mentioned, let’s take example for books, will the field type be books or text?

It would be a “list of posts”

This is what I have done, I have created a new field ‘list of posts’ and then within links and books I have created a list of - list of posts under links:

Hey @harshala, I think you misunderstood what I was suggesting. Just sent you a pm!

This topic was automatically closed after 70 days. New replies are no longer allowed.