Is it possible to create fields which are not included in the output?

Yes! Just start your field name with two underscore "_" characters (e.g "__myHiddenField") and it will be omitted from the output. This is useful when creating intermediary fields for use in formulas and templates.

How can I tie the value of one field to another?

There are several ways to do this:

  • Upload your own datasets to ensure integrity across multiple fields. Note that the datasets feature only supports CSV and JSON data. Other types such as Excel are not supported at this time.
  • Use Scenarios to shape numeric values based on other fields in your schema.
  • Use the Formula data type to generate values based on other fields.
  • Formulas can also be use to implement simple if/else logic.
  • Use the Template data type to concatenate multiple string fields.

How can I generate data for specific keys in my database or other datasets I've downloaded from Mockaroo?

Upload your key values as a datasets. Then, include key fields in your schemas using the "Dataset Column" type. If you need to include related non-key values when generating data data, include those fields in your datasets as well. Please note that the Datasets feature only supports CSV and JSON data. Other types such as Excel are not supported at this time.

How can I reference a field in a dataset from a formula?

You can use the from_dataset() function to reference a field in a dataset.

from_dataset(datasource_name, field_name, lookup_criteria)

For example, if you have a dataset named "users" with a field named "email", you can reference it in a formula like this:

from_dataset("users", "email", id: user_id)
  • The first parameter is the name of the dataset
  • The second parameter is the name of the field in the dataset
  • The third parameter is the lookup criteria as key/value pairs. In this case we find the record in the dataset whose id value matches the user_id field in the record being generated.

In formulas, how can I reference a field by name that has spaces or other special characters not allowed in a Ruby variable name?

Use the field() function to reference a field by name.

field("My Field Name")

In formulas, why doesn't "else if" work?

Formulas use ruby syntax, which uses "elsif" instead of "else if". For example:

if field("My Field Name") == "foo"
  "bar"
elsif field("My Field Name") == "bar"
  "foo"
else
  "baz"
end

How can I generate start and end dates that are randomly spaced apart where the end date always comes after the start date?

Use the date type for start_date and the formula type for end_date with a value like start_date + days(random(1,5)) to generate an end date between 1 and 5 days after the start date.

How can I share my saved schemas with others?

  • Send them the share link at the bottom of your schema. They will be able to download data or clone your schema, but cannot edit it directly.
  • Create a Project, add your schema to it, and invite collaborates.

I can't generate data or my data generation is stuck in queued status. What's wrong?

Mockaroo only generates one dataset at a time for each user. If you have multiple datasets queued, they will be generated in the order they were created. Occasionally data generation will get stuck. If this happens, you can cancel the stuck dataset from to the Downloads page (the cloud icon in the header). After cancelling, the next download in your queue should start after a few seconds.

Will various geographic fields such as city, country, and postal code generate real locations?

Yes, each of the following groups of fields are correlated:

  • Country
  • City
  • State
  • State Abbrev
  • Postal Code
  • Latitude
  • Longitude
  • Currency Name
  • Currency Code
  • FDA NDC Code
  • Drug Name (Brand)
  • Drug Name (Generic)
  • Drug Company
  • ICD9 Diagnosis Code
  • ICD9 Dx Desc (Long)
  • ICD9 Dx Desc (Short)
  • ICD9 Proc Desc (Long)
  • ICD9 Proc Desc (Short)
  • ICD9 Procedure Code
  • File Name
  • Mime Type
  • First Name
  • Gender
  • Last Name
  • Email
  • Username