DEV Community

TJ-MD for WayScript

Posted on

Tutorial:Automate Weekly Sales Data Reporting

Introduction

Creating reports about any kind of data can be a taxing process. From finding the right data, processing it correctly, preparing visualizations, and distributing the report to your team, we can find ourselves spending hours manually doing this. These types of business automations was what WayScript was built for. We provide an automation software that can do all these tasks and more. Let's see how we can create custom business software that will automate these interactions, no computer science degree required! Let's get started.

Prerequisites

No prerequisites but some content you might find helpful:
Working with Databases
Working with Python
Working with Data Visualizations
Working with Dashboards

Unpacking Our Requirements

Fully automating your own business processes requires unlimited customization from the platform. This is something we fully embrace at WayScript. We know every business needs different tools, so instead of trying to provide a "one size fits all" solution, we provide the tools to rapidly develop your own custom tools. This ensures that exactly what needs to get done, will get done.

For the purposes of this tutorial, we'll assume a few things must happen to fully automate your reporting. But please note that if something isn't covered here from your workflow, it is likely very easy to build (or already built) with WayScript! Here's what we'll assume:
Sales data needs to be pulled from a data storage.
-This data then needs to be filtered/processed for relevant information.
-This relevant information needs to be turned into visualizations.
-These visualizations need to be hosted somewhere for your team to find.

Let's walk through how we can build each of these requirements.

Pulling Data from our Database

We support several data storage intergrations. Among these are sql databases, google sheets, excel, airtable, and others. We'll use a sql database for this example, but the other data storages function in a similar way.

Connecting our Data Storage is relatively straight forward. Once we create a script on our profile, we pull the module into the script.

SQL

If you've never used that module before, you'll be asked to authenticate WayScript or to connect your database. If you get stuck in setting up your database, this video tutorial may be of use. Once you've connected your database, we can click on edit code to the left. This gives us the ability to write full sql commands against our database, just like how we would locally.

SQL command

Our SQL can be whatever we need to meet our requirements. We can query and write from this editing screen. Let's write something simple:

SELECT SUM(quantity)
FROM order_summary
WHERE product='A';

Next, we can import the values that we need from the database into WayScript. Here there's only one values because we're using an SQL sum function, but if your data has multiple columns, there will be multiple to import available.

values

Once we import this data, it becomes available to us as a variable to be used throughout the rest of our script. We can pass this value or list (representing your column) on to whatever module we want to use for additional processing.

Processing our Data

To process or filter the data to meet your requirements, we have developed tools for all types of users. Nontechnical users may enjoy the programming logic we have built into the platform. Any looping, conditionals, or iterations can be done using drag and drop modules. A more technical user may enjoy writing custom code to do this part of the automation. We currently support some programming languages such as Python and JavaScript. If your programming language of choice is not currently supported, reach out to us on our discord. We're always happy to implement new modules!

An example of using python code to process your dataset, would look like this in your editor:

Python

Using python to do this processing is very straight forward. We would use the variables we created with the SQL module, import them into the python editor, and output the processed data as a variable. We have a youtube video tutorial of working with Python if you would like to see more about working with python.

Working with Data Visualizations

On WayScript, we have built in data visualization tools that you can use. We would use these by pulling in the charts module below our processing step. In the example that we're building, that would look something like this:

data visualization

The charts module can be used to build bar and line charts that work as variable objects. That means we can pass them to other modules in our workflow, such as online dashboards. Creating an example chart might look something like this:

chart

We can specify multiple series on the same graph, create separate charts for different series, or whatever else your requirements involve. Like stated above, this visualization becomes a variable that we can pass to other modules throughout our workflow. This can be useful if you're building a dashboard type url for your teammates to view your data.

Working with Dashboards

We know how to get data now, how to process it, and how to create visualizations with it. Let's look at how we can create dashboards with it now. Dashboards on WayScript will provide an URL that you can password protected if you want to. To create a dashboard, we'll need to enable url endpoints in our script using the http trigger. This will give us the url. upon anyone visiting this url, our script will run. Let's serve a response to the user of a dashboard. Our script would now look like this:

script

Example of a Completed Dashboard

While not sales related, if you want to view a completed dashboard. We have a company one hosted here. Each time someone visits the url, a similar occurrence happens that was described above. Data is pulled from a source, is processed, placed into charts, and then those charts are passed to the dashboard response. If you want to see that script, it is available on our marketplace our found here.

Top comments (0)