Identical fieldkey issue in form confirmation message

We use a list of values that check a submitted form and returns data entered in the form confirmation message. If nothing was entered in fields there is no corresponding output which is the way its supposed to work. For example: %value[firstname] would return data entered in (text field) fieldkey firstname.

Here’s the issue: We have duplicate fieldkeys under different fieldsets. Either one or the other would be used: never both. The problem is that only the one with the highest component ID (CID) will return a value in a confirmation message regardless of the one used in the form.

For example: regardless of which field was used only the one with CID of 226 would return a value on the form confirmation message assuming that is the one with a value.

%value[sellerid] with a CID of 130

%value[sellerid] with a CID of 226  

Needed solution: We’re looking for a way to check duplicate fieldkeys so the one with a value would display on the form confirmation.  

Why duplicate fieldkeys: we have complex forms where some fieldkeys are used in unique circumstances which requires creating identical keys under different fieldsets. Our database only exports the one with a value so the process works. The issue is only with the form confirmation message.

Thank you for taking a look.

Drupal version: