Cannot delete because DataSet is in use on one or more Layouts

Thank you for your message and sorry to hear about your issue. To resolve this issue you will need to locate the layouts that are using this dataset. I have been testing a MySQL query you can use to locate the layout IDs that are using the dataset. Please note that this query will not work with layouts that have the dataset ticker or view widget inside of a subplaylist widget.

You will need to make the following query against your CMS database. If you are using a Docker based installation this guide will help you to make a SQL query against your CMS database.

This is the query I ran against my database, which confirmed the Layout IDs that are using the dataset:

select region.layoutId from widgetoption inner join widget on widgetoption.widgetid = widget.widgetid inner join playlist on widget.playlistid = playlist.playlistid inner join region on playlist.regionid = region.regionid where widgetoption.`option`="dataSetId" and widgetoption.`value`="2"; 

Please note that you will need to change the number in the `value`="2"; to match the ID of the dataset on the Datasets page in your CMS. For example, I crated a test dataset and assigned it to some layouts:

You can see the ID is 3 for this dataset in the first column. I also created a couple of test layouts that are using the dataset:

When I run the above query against my CMS database but with the last number set to 3, I get the following output:

I can then remove those widgets using the dataset from those layouts and successfully delete the dataset.

While I was looking for a solution to your issue I couldn’t help but note that an option that reported what datasets are being used with which layouts could make this easier for users in your situation. I have written a feature request about this and forwarded it to the developers. I cannot promise it will be created but the developers are certainly aware of your issue and will consider how this could be easier for users in the future.

Many Thanks.