Useful Mockaroo formulas

Mockaroo is a great tool for creating test data, with lots of good options as well as extensive base data. Sometimes though, you need to build custom fields. Here are a few I have used recently.

The top items are lacking in sophistication, but they do get better I think. To do – replacing random with a better probability function, and adding some more as I progress through making up more test data.

Item Formula Remarks
Decreasingly likely selection’ ['A', 'B', 'C', 'D', 'E', 'F'].slice(0, random(1,6)).sample Upper param for random is length of list to select from.
Slightly more realistic range of Title if field('gender') == 'Male' then 'Mr.' else ['Ms.', 'Miss', 'Mrs.', 'Mrs', 'MRS', 'Dr', 'Dr.', ''].sample end Assumes a gender field.
Male honorifics ['Mr', 'Mr.', '', 'MR', 'MR.', '', 'Dr.', 'DR.', ' ', 'Imam', 'Rabbi', 'Sir', 'Prof.', 'His Honour Judge', 'Lord' ].slice(0, random(1,15)).sample No link to gender field. Note use of blanks to make values decreasingly common as you go to the right. Don’t infer anything from the ordering especially of religious titles. If ‘Rabnbi’ is too long, you can use ‘R.’ instead.
Female honorifics ['Mrs', 'Mrs.', '', 'MRS', 'MRS.', '', 'Dr.', 'DR.', ' ', 'Imam', 'Rabbi', 'Lady', 'Prof.', 'Her Honour Judge', 'Lady' ].slice(0, random(1,15)).sample Follows same probability distribution as male list.
Gendered Honorifics based on the above. if gender == 'Male' then _title_male else _title_female end
Month names ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'][month(__dob)-1] Used for Oracle import.
Oracle date format format(day(__dob),0) + "-" + ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'][month(__dob)-1]+ "-" + format(year(__dob),0) Use as a formula field.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s