Downloading Uploaded Content

Hello everyone. I have a question. I know how to download documents from a database, but i want it to be a little more advanced. How do i do it so that my download button is disabled if there is no document in the databse, and enabled if a document is found. I also need the text to be changed, for example from “Download” to “No Files”. How do i do this? Thanks.

Hi,

You can use the if else statement by the next sample (just define the condition):

      if ("if there is no document in selected/displayed item") {
      	$w("#downloadButton").disable();
        $w("#downloadButton").label = "No files";
      } else {
      	$w("#downloadButton").enable();
        $w("#downloadButton").label = "Download";
        $w("#downloadButton").link = "selected/displayed item link";
      }

If it’s not clear enough, just share more details and I’ll take a look.

Thanks.

Thank You, but what should I write in the “if there is no document in selected/displayed item” section?