Internally, the record is a tuple {Name, v1, v2} , so your example record will look like {blah, 7, data} as a tuple.
With this in mind, you can use the lists:keyfind/3 function to search for an entry in a list:
lists:keyfind(7, #blah.id, L).
The first argument here is the ID value, the second argument is the tuple index for the ID field, and the third is a list.
The syntax #Name.Field allows you to get the field index for any field in the record.
source share