My approach to display these calculated field values in the table is to take the entries list, calculate the values using Enum.map, and then map.merge with the original. Like below:
Your code is confusing: you are iterating over a bigger txs map but merge stuff to it inside each and every iteration? Didn’t you mean Map.merge(tx, ...) in your code?
Regardless of that, what’s more performant at runtime is to use the map | merging operator:
Do have in mind that this requires that the fields already exist in old_map or else you get a runtime error. You cannot use this construct to add new keys to a map.
Either change the defstruct to allow for the additional fields and use already proposed map update syntax (%{ foo | bar: value } or if you can’t change the defstrucht use Map.from_struct and then use Map.merge/3 or Map.put/3 or Map.merge/2,3.