Dynamic Record Reference

I have a flow service that works on a record reference.
I need the record structure that’s being referenced to be different based on some criteria.
I am attempting to do the following:

but it’s not working. The second definition always get overridden by the first so all I ever have is FlatFileRec(FlatFile810).

The second problem that I see arising is that I need to map the output of convertToValues, which is EDIValues to FlatFileRec. The problem is that as far as I know I must define my FlatFileRec structure under the EDIValues record but that sturcture will be different depending.

Any ideas on how to solve this?