Editing in SQL and Interactive Modes

Charts

Prevent losing changes in Interactive or SQL Mode by making sure to only save your chart in the Mode you will be working with going forward.

You can always clone your chart if you would like to save a chart in both Modes.


Here is a breakdown of how running queries and saving your charts works in Chartio:

If you build a chart in Interactive Mode, the SQL query will automatically be populated on the backend to SQL Mode based on the columns added to the Measures, Dimensions, and Filters. The query in SQL Mode will continue to be updated based on your selections in the Interactive Mode interface until you switch Modes.

Preview Dataset SQL

You can easily preview the SQL query that is being generated from Interactive Mode without needing to switch Modes. All you need to do is click on the “Preview SQL” button in the chart editor.

Click Preview SQL

This will open up a preview of the SQL query which will be run from the data pulled into the drag-and-drop interface. As you make changes to the Interactive Mode query, this view will be updated as well.

This is a great way to learn SQL or see what Chartio is doing behind the scenes.

Final result

Switching between Modes

If you run a query in Interactive Mode, the chart will run the query based on the column(s) selected in the drag and drop interface. If you switch to SQL Mode, add text to the query, and run the query in SQL Mode, it will use the SQL Mode query only. If you then switch to Interactive Mode and run the query again, only the drag and drop query will run.

If you then switch back to SQL Mode, you will still be able to view any changes you’ve made to the SQL BUT if you save your chart, it will be saved in the Mode you are currently viewing. If you want to keep your SQL script, you must save your chart while viewing in SQL Mode. This will erase your Interactive Mode query but keep the SQL script. If you save while in Interactive Mode, the SQL Mode query will be overwritten with the current drag and drop query.

Restoring SQL Mode queries

If you accidentally save your chart in Interactive Mode instead of SQL Mode, you may be able to retrieve your previously saved query by clicking on the Query History icon on the top right hand side of your SQL Mode query.

Query History



Related Charts Help Articles

See more