X query (Excel)

From Tygron Preview Support Wiki
Revision as of 10:54, 3 March 2021 by Rudolf@tygron.nl (talk | contribs) (Created page with "framed|right|Example of what will happen with an X query with 3 neighborhoods. In some cases, especially when developing projects which are prone to change...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Example of what will happen with an X query with 3 neighborhoods.

In some cases, especially when developing projects which are prone to change, or when creating project templates, it may be desirable to add queries to your excel sheet which retrieve all of a certain type of thing. For example, each project can have a different amount of neighborhoods. In these cases you can't create queries for all the items you wish to retrieve. Instead, you can use X queries to instruct the Tygron Platform to dynamically create the queries for you. For any given query with uses an ID, you can replace the ID with X, with the result being a query such as SELECT_UNITS_WHERE_NEIGHBORHOOD_IS_1 turning into SELECT_UNITS_WHERE_NEIGHBORHOOD_IS_X. Only one X term may exist in a query, but you may add multiple X queries to an Excel file.

When an Excel file with one or more X queries is uploaded, the Tygron Platform prepares it for calculation by transforming the single X query into a column of queries which refer to specific IDs. When multiple X queries have their X refer to the same type of element from the project, the amount and order in which the IDs are filled in are consistent. The created queries are placed in the same column as the original X query, starting in the cell directly below the X query and continuing downward. The X queries are then removed. In other words, when using an X query, the first cell in that column with the intended query will be the cell under the X query. Each cell which now has a query will be properly filled in by the Tygron Platform. Note that not every cell in the column is given a query. If there are more cells with values than are overwritten by queries, those excess cells retain their value. From this point on, the file is used as normal.

The original Excel file is saved by the Tygron Platform. When a change occurs which would affect how many and which queries should be generated from an X query, it's possible the Excel file needs to be re-prepared for use in the Tygron Platform. It is possible to trigger the Tygron Platform to do this, by using the "Reset X Queries" option in the editor.

Editor → Recalculation icon (Ribbon bar) → Reset X queries (Dropdown)

When the original file is downloaded, it will be the file with the X queries, before the exact queries were generated from them. When the file with the current values is downloaded, it will contain the generated queries, and not the X queries themselves. It is recommended that you don't reupload the file with current values, because it is no longer generically applicable.

Please also note that X queries only refer to elements that were already present before the start of a test run. Any change done during a test run (placing of a building, adding of a neighborhood, etc) has NO effect on the X queries.

XA Queries

To select specific Items (for example neighborhoods or areas) in combination with a X query, use a XA query. XA queries will select only Items with a specific attribute.
Example: SELECT_ID_WHERE_AREA_IS_X will show all areas, using SELECT_ID_WHERE_AREA_IS_XA_PEIL will only show the areas with the attribute PEIL (where the value of PEIL is not 0).