How to create deviating behavior for a single instance of a Template Panel

From Tygron Support wiki
Jump to navigation Jump to search

When using a Template Panel, in some circumstances it may be desirable to have a single instance of the Template Panel (or a subset of them) behave differently than others. For example, when two types of Neighborhoods exist in a [Project]], and depending on whether the Neighborhood is residential or industrial information should be dispalyed which either shows the amount of available housing or the amount of industrial floorspace, in addition to some information which is consistent between both types of Neighborhood.

It will be tempting set up the Template Panel for one type of Neighborhood, apply it, and then replace the content of some of the resulting instances with content befitting the other type of information you wish to display in those instances. This route is not recommended, as when the Template Panel is reapplied, those changes are removed and new instances with content matching that of the Template Panel are created anew. Instead, it is desirable to set up the Template Panel so that it can display information for both types, but dynamically determines which information to display.

For most users and situations, this is easiest when using an Excel Template Panel.

Editor → Current Situation (Ribbon tab) → Panels (Ribbon bar) → Template panels (Left panel) → The Panel to edit (Sub-option)
How to create an Excel with differing output based on an Attribute:
  1. Create an Excel file which will compute the desired output for the panel.
  2. Ensure the Excel file has an EXPLANATION cell.
  3. Create the queries and logic to determine the desired output for the Item.
  4. Ensure the result of that logic ends up in a cell which is not the EXPLANATION cell.
  5. Create the queries and logic to determine the alternate output for the Item.
  6. Ensure the result of the alternate logic ends up in a different cell, which is also not the EXPLANATION cell.
  7. Create the queries and logic which can determine whether the normal output or the alternate output should be used.
  8. Add a formula to the EXPLANATION cell which, depending on whether the normal or alternate output should be used, places either the normal or alternate output in the EXPLANATION cell.
  9. Upload the Excel file to be used for the Template Panel.
  10. Apply the Template Panel.
  11. If done correctly, and some of the Items indeed require the alternate output, some of the Panels will display the normal output and some of the Panels will display the alternate output.

Notes