I am attempting to create a foreign key in one of my schemas by referencing the primary key in another schema using the Dataset Column type. No matter what I try the Dataset column is null. It doesn’t seem to matter what dataset I choose or what column within the dataset I choose. It is always returning null. Has anyone else run into this issue?
Is locationID
your foreign key? If so, you will need to use the function from_dataset(). This function allows you to lookup a value in a dataset with criteria. Hope this helps.
from_dataset("dataset", "column", join_criteria)
=> Fetches a value from a dataset.
For example, from_dataset("People", "name", id: person_id)
returns the value of the “name” column from the “People” dataset where the id column matches the person_id column in the current schema.
Having to use that from_dataset functoion would defeat the whole purpose of having the Dataset Column type. In their YouTube tutorial they do not use the from_dataset function so I don’t think that is the issue. I tried it just for grins and it is still coming up with null for the foreign key.
Ah yes, my bad. Can you share your schema’s?
Members - https://www.mockaroo.com/a4f50d60
Locations - https://www.mockaroo.com/70170a30
Currently the Members schema has a formula in the locationID that is just putting a random number in to work around the issue
Changing your Locations dataset field labeled locationID
to locationid
seems to work. If I recall @mockaroo had mentioned something on another thread about case-sensitivity.