Dataset column lookups

I have a dataset that has a code and amount field called AmountData. Code is a field in my schema being populated from another dataset. I would like to populate the Amount field from AmountData which does a lookup of the appropriate amount from the dataset using the value of the Code field and populating the corresponding amount. How do we accomplish this?

You can use the from_dataset function in a formula field. From the docs:

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.

Here’s a link to the docs for formulas: http://mockaroo.com/help/formulas

1 Like

Thanks for the prompt reply! I will give that a shot…

I’ve two datasets with list of urls in each, just one column without any column names. I want to get a random row from dataset1 if a condition matches else get a random row from dataset2. I’ve tried the following formula

if field("IsDataset1") == 'yes' then from_dataset("dataset1") else from_dataset("dataset2") end

i get the following error

error: wrong number of arguments (1 for 3 )

however, i don’t understand what possible values i could give for columnName and join_criteria as both datasets are single column and has no header.