Creating Unique Slugs Based on User Names from Relations

Options

Hi there, I can't help my novice skill and knowledge. I need help, please.

I want to create a slug based on users' full names. I attempted to add the slug field to the 'user' table but discovered that I couldn't have more than one unique index. So, I added the slug field under my 'profile' table, which already has a relational field linked to 'user.id'. In the 'profile' endpoint of the API, how can I filter:

[the current user who will create a 'profile' data: extracting the full name from the 'user' table] is not the same as [any user with the same full names]?

This would enable me to generate an incremental slug based on the creator's full name within the 'profile' database.

Any insights or guidance you can provide would be greatly appreciated. Thank you!

Answers

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    For two questions I would run two queries using query-all-records. Then check the answers from both - if they come back empty, you're good to go.

    Xano's power really comes out when you start adding steps to the function stack. Explore that a little bit and I think you'll uncover a lot of opportunity.

  • creapel
    creapel Member
    Options

    Hi Ray, thank you very much for your response. What I'm still struggling to understand is how to utilize the fullname field in my 'user' table as a criterion for determining whether it's 'equal to or different from' the fullname of the current user's profile, which I need to specify in the 'query-all-records' when I'm working within the 'profile' endpoint of the API.

    Is there a tutorial available that I can watch regarding this matter?

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    Sorry I lost track of this thread. Did you crack your problem?