1. John Vanleeuwe
  2. PowerBuilder
  3. Tuesday, 23 April 2019 09:40 AM UTC

Hi guys,

 

We have implemented a solution where our app is checking for the existence of txt files in a certain folder. Another application is sending to us TXT files , which we need to process and delete when done.

 

We used the Dirlist method and this works almost perfect.  Problem is our customer wants us to handle the incoming files by date-time stamp and not in the alfabetically order of the filename which is used by the dirlist method.

 

I've done some searching and found a few suggestions of using an external datawindow , then FindFirst file api and so on to feed the datastore with the filename and timestamp , sort the datastore and then start processing.

 

This seems to me like so much overhead, wouldn't it be easier if APPEON could extend the Dirlist function with an extra parameter where you can decide the sorting order of the result set ?

 

Is there any possible solution available without having to use the findfirst api/apis please ?

 

 

TIA

John

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 23 April 2019 16:38 PM UTC
  2. PowerBuilder
  3. # 1

Hi John;

   Have you tried this approach ...

https://www.tek-tips.com/faqs.cfm?fid=6949

Regards ... Chris

Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Tuesday, 23 April 2019 14:10 PM UTC
  2. PowerBuilder
  3. # 2

i agree john.   

Adding better system functions instead of forcing us to call APIs allows us to use the same code on mobile, as well as makes everything easier for developers.  It should also insulate code from future changes in the OS if we stay current with PB.

I don't see why this should be any different than adding the https/crypt functions.  Everything that appeon added for calling rest web apis could already be done using roland's api objects.  Deciding whether to add good directory functionality should be a no brainer just as adding the rest functionality was.

 

appeon is making changes, so it is probably just a matter of requesting the change:   https://www.appeon.com/standardsupport

and them having the resources to do it. 

 

 

 

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 23 April 2019 12:35 PM UTC
  2. PowerBuilder
  3. # 3

The DirList function is calling the same API functions that my example code uses. It is pretty simple to call the API functions and put the result in a datastore.

If you want them processed via DirList, you'll have to have the files created with create date as part of the name.

Are you are calling DirList in a timer event? There are notification API functions that will let you know when a file is written so you can process it immediately. That would eliminate the need to sort them.

Comment
  1. John Vanleeuwe
  2. Tuesday, 23 April 2019 12:48 PM UTC
Hi Roland,



I will have a look again at your example. Ultimately i would like APPEON to extend the dirlist function, to have some additionnal parameters. Or just one , a sorting one :) would fix my problem.



Yes i am calling the dirlist in a timer event. At the moment i am a triggering the timer event and looping. But it happens that in one second there are no files and the next second there are a few hundreds ... Which i can't process all in one time before the next timer function kicks in...



I am not in control of any of the naming conventions nor do i know what to expect as contents inside the file. So i am not sure how this notification API can be of any help ? Have more tips /clues ?



Thanks Roland for your advise , time and experience.



Kindest regards

John

  1. Helpful
  1. Roland Smith
  2. Tuesday, 23 April 2019 15:38 PM UTC
I'll work on a file notification example.



The simplest way to do it would be to turn off the timer while you are processing the files by calling Timer(0). Use the API functions to pull the files into a datastore that you sort on date. Then when you are done processing, turn the timer back on.
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 23 April 2019 10:27 AM UTC
  2. PowerBuilder
  3. # 4

The DirList also changes the current directory of your app.

The only way to do it differently is via API. Here is an example app:

http://www.topwizprogramming.com/freecode_filesys.html

 

Comment
  1. John Vanleeuwe
  2. Tuesday, 23 April 2019 10:29 AM UTC
Tried this in the past , but no success Roland, also this seems so much overhead and adding complexity to our system , just to get the creation date of a file ? There has to be more easy solutions than this... one would think ... :)

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.