Retool Apps and Workflow

Hi

I am actually new to programming (I know basic python though) and web development.

I have been trying to use Retool to develop an internal tool for my company.

Among the first things I have been working on is

  1. Adding a filebutton in a retool app - upload the file to retool storage
  2. Use event handler to start a workflow when the above action is done
  3. Now I am not sure how to use this file - run a python code on it so I can return a zip file to the user which downloads automatically after the end of this

I have been trying to read across the documentation - but I feel lost.
Any help would be appreciated

Welcome to the community, Retool, and programming H_R!

I think one of the biggest gaps in our docs or world of education is bridging the gap between these kinds of "hand offs" -- where you have an interactive app that kicks of a workflow that then completes a task and... then what?

I'd like to help but I need to know just a little more to give you the best advice.

It sounds like you've already handled some of the hardest parts -- handling the upload, spooling it to a workflow.

With the file that's being uploaded -- is it something you need to manipulate and change before compressing into an archive? Or do you just need to take the file as given and wrap it in a ZIP file? Is it going to always be a string (like a JSON or text file?) or will you be sending binary data too?

When you return the ZIP file to the user eventually, do you need it to persist in storage at all or only be available at the moment of serving?

Hope I can help!
Taylor

2 Likes

Hi episod!

Thank you so much for getting back to me

I eventually did figure it out a way (I am not exactly sure how it works - but it works).

Yes I did need to manipulate the data (and create new files from the uploaded file) and then zip all the new files together to be served to the user.

And no - I just wanted it to be available at the moment of serving (though the way I have implemented right now does not work that way)

As of now - I made it in such a way that - when the user uploads the excel file - it is stored in retool storage and starts a workflow - which then accesses the file and runs a script to create the files I need - which is then zipped and saved back to retool storage. The user have to press an another button to start downloading this new zip file.

I don't expect it to be the best way of doing this - so if you have any advice - it would be greatly appreciated!

Glad to hear it, @H_R! Thanks for the update. It sounds like the only room for improvement is getting the download to happen automatically after the ZIP becomes available. This is definitely possible, but might require tweaking your current setup a bit.

At a high level, I'd recommend defining three separate queries within your app that can be chained together via Success event handlers.

We can pass the necessary data from one to the other by referencing queryName.data where necessary. In my version of the workflow, I pass in the id of the file that was initially uploaded and return the id of the resulting file.

You can take a look at the details of my app (16.6 KB) and workflow (27.1 KB) JSON here! Let us know if you have any additional questions. :+1:

1 Like

Thank you!

1 Like