Adding a listener to a folder

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Adding a listener to a folder

Postby alasdairs » Fri Mar 15, 2024 12:14 pm

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
Software Engineer
alasdairs
 
Posts: 45
Joined: Wed Dec 27, 2023 10:06 pm
Location: The Internet

Re: Adding a listener to a folder

Postby rafig » Fri Mar 15, 2024 2:01 pm

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 ;-)
Servoy Certified Developer
Image
rafig
 
Posts: 708
Joined: Mon Dec 22, 2003 12:58 pm
Location: Watford, UK

Re: Adding a listener to a folder

Postby hilgers » Fri Mar 15, 2024 2:32 pm

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...
Joachim Hilgers
Hicosoft GmbH
Cologne, Germany
hilgers
 
Posts: 13
Joined: Wed Feb 15, 2012 1:29 pm
Location: Cologne / Germany

Re: Adding a listener to a folder

Postby alasdairs » Fri Mar 15, 2024 3:40 pm

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.
Software Engineer
alasdairs
 
Posts: 45
Joined: Wed Dec 27, 2023 10:06 pm
Location: The Internet

Re: Adding a listener to a folder

Postby alasdairs » Fri Mar 15, 2024 4:13 pm

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.
Software Engineer
alasdairs
 
Posts: 45
Joined: Wed Dec 27, 2023 10:06 pm
Location: The Internet

Re: Adding a listener to a folder

Postby rafig » Fri Mar 15, 2024 4:38 pm

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)
Servoy Certified Developer
Image
rafig
 
Posts: 708
Joined: Mon Dec 22, 2003 12:58 pm
Location: Watford, UK


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 29 guests