Prevent File Export When No Checkboxes Are Selected in My Dashboard

Ioana
New Contributor III

I have a dashboard that has a button and multiple checkboxes attached.

When clicking the button, I want it to verify if the user has checked any boxes, and if so, export data that corresponds to the checkboxes.

If no checkbox is selected, upon clicking the button, I want the user to receive the following message: "No export option was selected. Please check the tables you want to extract and try again."

The current behavior works for when a checkbox is selected. But if I uncheck all boxes and hit the button, it gives me the message, but also opens the file with the data that corresponds to the last checked boxes.

The navigation action for the button is currently set to Open File.

Any ideas on how to stop opening the file if no checkboxes are selected?  Thank you!

2 REPLIES 2

sameburn
Contributor

Hi @Ioana have you tried deleting the file at the start of your logic (e.g. before file is generated)? e.g. 

Dim fileDelete As Boolean = FileHelper.DeleteFileWithRetries(exportFilepath, True)

This means it only generates the file if your conditions are met and any residual file would be cleared before we hit your conditional logic and regenerate the file

Hope this helps

FredLucas
Contributor III

Hi @Ioana,

Based on what you explain, I'm assuming you are already using a dashboard extender rule to evaluate the values of the combo boxes and determine the message and what data export.

If that's the case I believe the only step you might be missing is, in case of no check boxes being selected, to update the selectionChangedTaskResult object returned by the dashboard extender so it cancels the Navigation Action.

You can do that by updating these settings:

Dim selectionChangedNavInfo As New XFSelectionChangedNavigationInfo()
Dim selectionChangedTaskResult As New XFSelectionChangedTaskResult()
selectionChangedTaskResult.ChangeSelectionChangedNavigationInDashboard = True
selectionChangedTaskResult.ModifiedSelectionChangedNavigationInfo = selectionChangedNavInfo
Return selectionChangedTaskResult