Is there anyway i can use a different ID as a table relationship value.

Options
I'm pretty new to all this.

So orders come in from our CMS every order has a customer.

I want to use the customer id that we already get from our CMS as the id instead of the standard customer id that the customer table has be default.

Is this possible?

Thanks




Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    You can display any field or fields that you want in a table reference through the auto-complete settings

    Keep in mind that when calling data through the API, the table reference will be the ID reference to the related table. You can use Addons to decorate that reference with the data you want.
  • Tim
    Tim Member
    Options
    Hey thanks for the reply. 

    I don't want just want display those fields there this is the number i want to reference to associate the relationship instead of the default id that is generated. 

    For example: 

    Order gets POST into DB from our CMS. The order already has a customer.id eg. 502154654654 i want to use this as id to reference the column in the customer table instead of the default generated id's 1,2,3,4,5,6,7, etc.etc. 


    I think it may be something like this? 

    https://www.geeksforgeeks.org/postgresql-identity-column/
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    There is a solution. You can set the shopify_id field in "customer" to have a unique index, which would allow it to act more like a primary key and make those lookups much more performant. You can also save that key in other tables as a regular value which will be able to do the lookup or joins on it with pretty good performance thanks to that unique index.  

    This is not exactly like the primary key. The relationships won't be enforced as a foreign key or displayed as a table reference, but you will get the functionality you are looking for!
  • Tim
    Tim Member
    Options
    Thank you all. Much appreciated!