Storing a known value based on a choice

I am trying to create a section of a form which stores a known grid reference based on the name of a location.

The user will select the name of a place from a dropdown menu and I would like the grid reference I have for it to be saved separately as a string.

I have tried doing this as a cascading select, but I would like a solution which doesn’t require the end user to even see the output. How would I go about this?

I have come up with a solution to use a long calculation of if statements but this seems like a very inelegant solution, especially as I will want to add quite a few more grid references in the future!

if(${site_code}=‘SWAR’ and ${plot_number}=‘T1’, ‘SD80756935’,
if(${site_code}=‘SWAR’ and ${plot_number}=‘P1’, ‘SD80586944’,
if(${site_code}=‘SWAR’ and ${plot_number}=‘P2’, ‘SD80596921’,
if(${site_code}=‘SWAR’ and ${plot_number}=‘P3’, ‘SD80756935’,
if(${site_code}=‘AUST’, ‘NA’, 0)))))

Thank you for sharing this with the community, @peat! But the community would also benefit more if you could share the sample XLSForm with the community!