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
A downloadLink cannot update anything. Sorry ...
What do you want to achieve?
Hello Stefan,
I just want when User click on the card document should be downloaded and at the same time rule input should be updated.Any other way to achieve it.
Thanks.
Not directly. But what is the purpose of updating the rule input?
once the document is downloaded, a message should be shown to user within the main interface.
OK. Then you will need to make the user click a second time after the download to make that happen.
Can you not add a back button or something like that for the user to return to the main interface?
Also, is this all for saving a user's click ?
If the user can wait for a while, then you could use refresh variables and set it to the min 0.5 interval (30 secs) and build up a logic to see if the user has clicked on the link and downloaded the document and accordingly revert them back to the main interface.
So, the max delay would be of 30 seconds to automatically display the message
agam said:logic to see if the user has clicked on the link and downloaded the document
Which functionality would you be using to ascertain this? I don't remember anything off the top of my head which could do this, though if I'm missing something I'd be interested to know.
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 ) } )
agam said:checking the user has downloaded this document or not
Yup, that's what I meant.
agam said:getdownloadersfromgroup function
Sweet, I think I'd missed this one. I think your code should work, though it's sad there's no way to force this to execute in a more real-time (since the lowest auto-refresh interval is ~30 seconds).