How can we help?
Search for answers or browse our knowledge base
Simulate a column pattern
This tutorial will show you how to create a form with a variable number of active columns, simulating a column pattern.
In our example, the correspondent can define a list of cities and for each city, a column will appear allowing him to specify for a given city the number of customers and the number of prospects.
Principle
We will define a maximum number of columns (10 in our example) and an array with all columns. The list of cities will be provided by the correspondent in a pattern. A conditional formatting will only display the number of columns needed, the others will be hidden (displayed in white on white) and data will not be available. A transposition will convert the columns of the table into rows in the database.
The file shown in this example can be downloaded here.
Implementation
Entering the list of cities
The Cities will be entered in a reason on which the respondent will have all rights:
Displaying cities in the table
We will first display the list of cities entered in the pattern in the first row of the table, using an INDEX formula.We want to retrieve the name of the city from the compartment data and will use a GTCONTROL declaration for this purpose.
The formula is extended over the range D2:M2.
Components and transposition
For indicators, we will define the components in a formula which will be applied to all columns. A field called INPUT_FIELD covering the range D4:M4;D6:M6 will be defined for this purpose.
After importing into Design, we apply the transposition of the columns into rows. The compartments structure will be as follows:
Hiding unnecessary columns
In order to hide (and lock) unnecessary columns, a conditioning is applied to columns D to M by simply choosing to hide the column if the label is an empty string.
Use
Here is a screenshot in GTAnswer, 3 cities have been entered: