Skip to content

Commit b3ac54e

Browse files
authored
Merge pull request #485 from sigmacomputing/fundamentals-6-fix
fundamentals-6-fix for issue 481
2 parents 9f506ef + bd607e4 commit b3ac54e

3 files changed

Lines changed: 6 additions & 29 deletions

File tree

1.29 MB
Loading
-49.3 KB
Loading

site/sigmaguides/src/Fundamentals 6: Controls - v3/fundamentals_6_controls.md

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ To read more about [creating flexible reports with parameters, see here.](https:
2727

2828
If you already completed QuickStart fundamentals 1-5, you have already used controls.
2929

30-
In [Fundamentals 2 - Data](http://localhost:8000/guide/fundamentals-2-data/index.html?index=..%2F..index#2), we created a filter directly from a table column (Store Region), and converted that filter into a page control. This control is an example of a `List control`.
30+
In [Fundamentals 2 - Data](https://quickstarts.sigmacomputing.com/guide/fundamentals_2_data_v3/index.html?index=..%2F..index#2), we created a filter directly from a table column (Store Region), and converted that filter into a page control. This control is an example of a `List control`.
3131

3232
Selecting the correct control is often more art than science, as there are many controls to choose from.
3333

@@ -294,7 +294,7 @@ Also notice that the `DATA SOURCE` indicates `+ 1` to let us know that there is
294294
<img src="assets/fcontrols_19.png" width="800"/>
295295

296296
### Add the switch control
297-
Add a `Switch` control to the page, rename it `Transaction Type` and set it's `Control ID` to `f6-c-switch-transaction-type`.
297+
Add a `Switch` control to the page, rename it `Transaction Type` and set it's `Control ID` to `f6-c-switch-transaction-type` and the `Filter Type` to `True/False`.
298298

299299
We can now toggle the switch control on and off, but the table is "aware" of it yet.
300300

@@ -303,43 +303,20 @@ We need to make the table respond to this controls value, as it is changed.
303303
Add a new column next to `Transaction Type`, rename it to `Switch`, and set its formula to:
304304

305305
```code
306-
If([f6-c-switch-transaction-type], If([Transaction Type] = "Purchase", True, False), [Transaction Type] = "Return", True, False)
306+
Switch([Transaction Type], "Purchase", True, "Return", False)
307307
```
308308

309+
You can also change the control labels under `Format` > `LABEL` to replace On/Off with Purchase/Return.
310+
309311
<img src="assets/fcontrols_20.png" width="650"/>
310312

311313
<aside class="negative">
312314
<strong>NOTE:</strong><br> This function allows for dynamic filtering based on the state of a switch control and the type of transaction. When the switch is TRUE, it filters for “Purchase” transactions. When the switch is FALSE, it filters for “Return” transactions.
313315
</aside>
314316

315-
#### How It Works in Detail:
316-
<li><strong>When [f6-c-switch-transaction-type] is TRUE:</strong>
317-
<ul>
318-
<li>The function checks if Transaction Type is “Purchase”.</li>
319-
<li>If Transaction Type is “Purchase”, the function returns TRUE.</li>
320-
<li>If Transaction Type is not “Purchase”, the function returns FALSE.</li>
321-
</ul>
322-
</li>
323-
<li><strong>When [switch-example] is FALSE:</strong>
324-
<ul>
325-
<li>The function checks if Transaction Type is “Return”.</li>
326-
<li>If Transaction Type is “Return”, the function returns TRUE.</li>
327-
<li>If Transaction Type is not “Return”, the function returns FALSE.</li>
328-
</ul>
329-
</li>
330-
</ul>
331-
332317
<img src="assets/horizonalline.png" width="800"/>
333318

334-
The last step is to add a table filter on the `Switch` column so that it responds to changes from the control.
335-
336-
Be sure to select only the True value, as that is what the control should be set to while we create this filter.
337-
338-
<aside class="negative">
339-
<strong>NOTE:</strong><br> We made sure all the other controls we set to allow all 4.5M rows appear in the table. You may have to refresh your browser if they count is not as expected, once the controls are set.
340-
</aside>
341-
342-
<img src="assets/fcontrols_21.png" width="650"/>
319+
In the switch controls configuration, add the `PLUGS_SALES` table as a `TARGET` and select the `Switch` column under that.
343320

344321
Now we can toggle between `Purchase` and `Return` transactions:
345322

0 commit comments

Comments
 (0)