8. More on cells: Control and Python: Getting Started in Count
Explore cell types in Count: Add control cells for dynamic filtering and Python for seamless integration. Enhance your data analysis with versatile options and real-time updates.
Transcript
So let's go back to cell types. We've covered a few, but there are a couple more to go. I'm gonna draw your attention down to the toolbar, just so that you know that you can use this toolbar to add some of these cells as well. You can add blank SQL cells from here. There's artificial and table cells. And next, we're going to look at control cells. So control cells are great for setting up filters for reports or using them to specify parameters in your analysis which you want to be able to change easily. There are lots of options for control cells, and I'd recommend watching the video about control cells and reading the documentation on these if you'd like to know more. I'm just gonna choose one to show you as an example today. So I'm gonna go for a multiple select. I'm going to add this to my canvas. It looks fairly nondescript, and we're gonna start by setting this up in the design panel on the right hand side. I'm gonna set dynamic controls. So this means that the options that users are going to be able to select from are going to come from a table. Let's say I want it from my original accounts table, and let's look at industry. I select that. So now that I have this set up, if I come to my control cell, we'll see that all the unique entries from the industry column are populated. And because this is a multi select, I can select one or more of these options. We're halfway there. We've created our control cell. But how do we actually put this to use? You'll see that we can reference this using some SQL, or we can use some ginger code here. I'll start by giving this a slightly more meaningful name. We'll call it control one and then you'll see that the reference using SQL changes. Essentially, control cells are just tables. So let's take this. I'm going to add the logic to connect this control cell. So here I have stated in my where clause that industry is in, and then I have just selected value from my control. I've used in because essentially has multiple results rather than equals. Now we have our control cell and we know that everything will update downstream. So let's have a look at our chart as we take off some of these options and now we can see that we are filtering not only on our SQL cell but all the visualisations that we've created as well. And there's one final cell type to talk to you. Right? Again, I will come down to add cell, and this time, we'll show you Python. We can move between SQL and Python seamlessly. I will just add in a simple Python script, and we can see all the elements are there. We have a title, we have some of our Python code, and we have our results. And just to demonstrate that, we can then go back to SQL if we want. I will just do a select star from that cell.