Let's continue thinking through more real-world examples to wrap our minds around the possibilities of Flatfile's Field Hooks, which — as their name suggests — clean up or validate data at the field level.
This is Part 2 of a 3-part series about Flatfile's Field Hooks. Read Part 1 - Field Hooks: cast first if you haven't already.
Suppose we need to convert all employee names to lowercase before reasoning about the data strings.
We'll use compute to modify the data in place before proceeding to
compute will receive data of the type determined by the field's cast hook
Then, it will perform a transformation to the value returned from
compute will always return data of the same type
While Field Hooks only clean up or validate data at the field level,
batchRecordsCompute come into play when you need to run computations across all fields in a single record or in bulk operations. More on Record Hooks soon.