Create a datasource microflow, retrieve the required data from db. Have a boolean to show the conditional visibility for the button. check if data is empty , set boolean to true else false. Thanks
In this case you can set one boolean variable for checking if data is available or not.
And use microflow as suggested by Deepha, retrieve data, check condition for data availability if true you can show it to user.
See documentation : https://docs.mendix.com/refguide7/conditions
If my answer is helpful, please mark it as accepted. Thank you.