Last night and this morning I learned that Loop Screens set up as Pre-Populated Grids are a little quirky when it comes to using reference data, so I thought I'd share what it took me a few hours to figure out.
If you're not familiar with Pre-Populated Grids, you can change the style of a loop screen with a Drop Down key field to Grid (pre-populated) under Style in the Loop screen's settings:
And it will give you something like this:
This is great for lists where you want users to go through every option, but you don't want them to have to continually choose each one. Here we have a list of options and unit costs, so all we need to do is input a quantity to get the total in the calculated Cost field.
But this is where things get quirky. If you add the key field (Option in this case), create the loop screen, and then add fields that use reference data (Unit Cost and Units in this case) to the loop screen, this will not work. Only drop down fields will populate with the reference data. Any number, text, or other fields using the same reference data as the key field will be broken and come up blank like below:
Instead, you must first add all of the fields and reference data relationships to the screen you will loop, then create specify the key field. This means your loop screen needs to be well planned out before you begin. If you need to add a field that utilizes the same reference data as the key field, you might need to recreate the entire thing. Moving fields does not affect their reference data, though.
Set up all the fields and reference data relationships (Unit Cost and Units use Option as their reference field):
Then create the loop:
The loop screen:
Hopefully this saves someone some time in trying to figure this out. I couldn't find anything that addressed this particular issue when I was trying to figure out why my fields wouldn't populate and spent quite a bit of time going through every option I could think of before stumbling on the right way of doing it.