documentdownload link

Hi All,

In My interface I am exporting the data story entity to csv using "exportdatastoreentitytocsv" .

once export is done, I am giving an option to download that exported file using documentdownload link in a card interface (I used card layout to make it effective).

Now when this document is downloaded I want to update a rule input  at the same time ( When user clicks on the card layout ,document download and rule input updating should happen at same time ), but I am not able to do it.

Can any one suggest how can I do that.

Thanks in Advance,

Siva Surya. 

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to Mike Schmitt

    I was thinking about checking the user has downloaded this document or not.

    GIven Siva mentioned originally that they are generating the csv, so the user would not have already downloaded this document before, and I am assuming they would want this download for one time basis,

    So, they can use getdownloadersfromgroup function available in the Content Security Utilities plugin to check if the user has downloaded the doc or not.

    Here's something I wrote to test this. Put a document and group in the local variable to test, see comments in code

    a!localVariables(
      /*Put any valid document here*/
      local!document: cons!MY_DOCUMENT,
      local!usersDownloaded: a!refreshVariable(
        value: getdownloadersfromgroup(
          { local!document },
          /*Put any valid group here of which you are a member of*/
          cons!MY_GROUP
        ),
        refreshInterval: 0.5
      ),
      local!documentDownloaded: contains(
        { local!usersDownloaded },
        tostring(loggedInUser())
      ),
      {
        a!cardLayout(
          contents: a!richTextDisplayField(value: "Download", align: "CENTER"),
          link: a!documentDownloadLink(document: local!document),
          showWhen: not(local!documentDownloaded)
        ),
        a!richTextDisplayField(
          align: "CENTER",
          value: "You have downloaded the document successfully",
          showWhen: local!documentDownloaded
        )
      }
    )

Children