Page 1 of 1

Adding a listener to a folder

PostPosted: Fri Mar 15, 2024 12:14 pm
by alasdairs
Hi all,

Is there any way of adding a listener to a folder where if something has been added to it servoy is notified?
I have recently made a barcode scanning mobile app that sends new stock to the server as CSVs and have a way to parse the information in servoy and push it to the database but currently it only checks for new stock when someone clicks on the sidenav 'stock' button. Is there a way to instead add a listener to the folder in servoy or would I have to create something outside of servoy to accomplish this?

Thanks!
Alasdair

Re: Adding a listener to a folder

PostPosted: Fri Mar 15, 2024 2:01 pm
by rafig
Hi (again)
In the past I created a batch process (that runs on the server), that ran every 'x' number of minutes, checked folder for new files, processed them & then moved them out of folder.
not most elegant solution, but worked ;-)

Re: Adding a listener to a folder

PostPosted: Fri Mar 15, 2024 2:32 pm
by hilgers
Hi,

if the scanning app was created by you why not send the data to a https://wiki.servoy.com/display/DOCS/RESTful+Web+Services
instead of dumping it to a folder?

just curiously asking...

Re: Adding a listener to a folder

PostPosted: Fri Mar 15, 2024 3:40 pm
by alasdairs
Hi again Rafig,
I was thinking about trying that, just thought there might have been a folder listener of some kind and didn't want to use up a client.


Hi Joachim,
Thats a good point. I'm currently doing that in the application, because it doesn't allow you to save directly to the filesystem so I'll give a go at changing it to send to the servoy server.

Re: Adding a listener to a folder

PostPosted: Fri Mar 15, 2024 4:13 pm
by alasdairs
Just ended up putting a cronjob on application open. Haven't done much http stuff yet so will probably look into doing that in the future.

Re: Adding a listener to a folder

PostPosted: Fri Mar 15, 2024 4:38 pm
by rafig
Cool
Joachim's idea is also good.
Very easy to implement REST stuff, check the Servoy YouTube channel and search for REST there... (also some samples in a forum post connected to video)