Reference by question

Options

Hi all!


This should be a simple one, but I'm new to Xano.

How can I link an App user to what they do in the App? For example, I have a 'Sign up' table with name, email and password fields. Users are then navigated to a profile screen (linked to a 'User' table) where they add a profile pic, gender, age etc.

I have a 'reference by' column for signup_id in my user table, but I have to double click and select the user from the signup table myself. When I actually have users will this update automatically (i.e. the information input into the user table will be connected to the users' signup_id)?

I have tried logging in myself, but my signup_id is not added to the user table as i had hoped/expected.

Thanks in advance.

Best Answers

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Answer ✓
    Options

    It would be much easier for me if you can share your table and function stack of the relevant endpoint.

    But here is an example of adding a record that contains relation to another table. In input I'm providing a question_id from the record that should be connected to the asnwer record I'm creating. From the front end perspective if you have a list and want to go to the detail page you should pass the id of clicked element to the detail page/state and use it call get API from Xano to get the details about the record.

    Hope that helps, if you need some more help, please provide more data.

  • jwhitlock
    jwhitlock Member
    Answer ✓
    Options

    if the data is coming from the front end, you'll want to add an input in your xano api with the user id so you can reference it when you create the event. then add a parameter to the api call in your front end to push that data to xano.

Answers

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    Hi,

    If you have refrerence to another table you still need to provide id of the record you want to refer to when you are adding a new record or you want to edit that field.

  • GavinReid
    Options

    Thanks for your response @Pawel Magdanski , could you explain how to do that in the simplest possible terms? I'm totally confused.

    In my frontend I need to have 2 parameters working on a detail page (navigated to by clicking on a list item in a feed): a user profile (with data from a 'user' table) and event information (from an 'events' table).

    I know I need to link the user to the event they created in Xano somehow, I guess using 'reference by', but I'm not sure how.

    Thanks again!

  • GavinReid
    GavinReid Member
    Options

    Hi @jwhitlock and @Pawel Magdanski,

    I think I have this set up correctly (perhaps it is more of an authentication issue?).

    If users can create an event in the app, I want the event to be passed to Xano with the user_id. The user doesn't input their id, because they are already logged in. However, if I log in as a user and create an event, the user_id does not appear in the ref by column (in the example below the user_ids have been inputted manually).

    Is this a case of setting up a user_id variable in my frontend for the API request? (If so, how would I do that?). Or have I not referenced tables correctly in Xano?

    Thanks again.

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    If your request to create an event require authentication then you have access to to user_id in auth tab, you don't need to pass it manually.

  • GavinReid
    GavinReid Member
    Options

    @Pawel Magdanski, where can I find that? Is it in the POST API? The closest I can find is in Add Recorn In, but when I click AUTH it says no results found:

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    Do you have you endpoint set up as authentication required?

  • GavinReid
    GavinReid Member
    Options

    @Pawel Magdanski I didn't, but I do now. I still can't find the auth tab though…

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    @GavinReid If you want we can have a short call and I will help you with that. drop me a message on pmagdanski@gmail.com

  • GavinReid
    GavinReid Member
    Options

    @Pawel Magdanski that is a very generous offer and I may take you up on it. For now, I have booked a 1-on-1 session with a Draftbit expert for Monday to try and learn a bit more about all this. If he can't show me how to do it (I have specified that I need help with interactions between Draftbit and Xano) I'll drop you a message!

    Thanks again, I really appreciate it!