Boiled down: Is it better to have the calculated field returned with the rest of the results or is it better to calculate it later when you need it?
Example: I have a GridView that displays search results that has many fields like:
- Application ID
- Name
- Account Type
- Account Number
etc.
The account number field is not always consistently the same thing though. For accounts of type A they are eight digits long and for accounts of type B they are twelve.
After the search if they select a record and choose to continue the application I need to check the eigit digit account number for any access restrictions. All accounts of type A and B have an associated eigit digit account number, it is just that type B are the only ones to have the twelve digit number.
So should I add a redundant hidden field like "Common Account Number" to the search results and just hide it, thus making the heavily used search take slightly longer and making the results grid take up more space in the view state?
Or
Should I call the database when they try to continue the application and translate the Application ID into the eigit digit number so that I can use it to do my access restriction check? This will require one extra call to the database but the translation should be fast as both fields are in the same table and the application ID is a primary key. The continue application button will be used less as there are many other command options. People are also more accepting of waiting for something to process rather than waiting for search results.