database view showing incorrect data

Options
When I add a record to the database the database view show additional information which is not persisted into the table when I create the record.

Here is the debugger view showing the business_id (42) that needs to be populated in the table:
[debugger.PNG]
Here is the table view:
[database.PNG]it seems to carry the tenant_id with for some strange reason on the view

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Can you provide some more details please? It'd be helpful to show the primary ID in the screenshot of your database view and also understand if there is additional logic in your function stack especially if it's interacting with the same database
  • Riaan Backer
    Options
     - please find below more information as requested.

    Logic implemented:
    [logic.PNG]
    Business table view showing primary ID:
    [business db.PNG]user_access table showing results:
    [user access.PNG]
    This is happening on multiple tables at the moment.
  • Riaan Backer
    Options
    Hi Xano Team

    Can I please have some feedback on this issue.
  • Riaan Backer
    Options
    Some observations, I have created a new Xano account and I experience the same issue also. I think its got something to do when you generate a UUID and persist this value into a table (keep in mind the UUID is not used a primary ID anywhere)
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     - I'm not seeing anything wrong with the last posted screenshots, maybe I am misunderstanding the issue.

    Can you please provide the instance, workspace, endpoint, and any input values needed to test in the support chat and we can take a look? 
  • Riaan Backer
    Options
     - I have found the reason why this happens. I will explain the problem again for clarity and also show I have managed to resolve this and now understands how Xano populates the value when you do a table reference for another table.

    I have a business table that looks like this.

    Note the following fields:
    id
    tenant_id
    legalname[business db.PNG]
    the portfolio db reference the business table

    Note the business_id description now reference a combination of the business.id and business.tenant_id

    [portfolio.PNG]
    I have come to realisation that Xano uses the id field and the first column value after the id column to populate the value in another table when you do a table refence.

    I have now changed the sequence of the db columns in the business table and the data reference looks much better. It would be nice to choose the column name when you use a table reference as the value.

    [db field swop.PNG]
    End results
    [fixed db.PNG]
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     Ah I see the confusion. 

    Yes the table reference is also known as a foreign key, which is also the primary ID of the referenced table. 

    Xano lets you use an auto-complete feature to display different fields in from the referenced table to help you understand and visualize the relationship. However, a table reference is purely a reference to the ID: 
    

    You can read more about table references and relationships in our documentation: https://docs.xano.com/database/database-relationships