Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / GetFirstFolder() seems to get Last folder not the First?

Author
Message
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 5th Jan 2016 18:26
I am finding that using GetFirstFolder() with GetNextFolder() return a list of sub-folders but in reverse order.
Is it meant to work this way, is there a bug or am I missing something.

I have a folder called Alphabet and 26 sub-folders called A through to Z. I was expecting A to be the GetFirstFolder() and Z to be the last from using GetNextFolder() but it lists folders Z to A.



I can reverse the "first through to last" easy enough using an array but feel this should be unnecessary.

Any ideas?

ps using latest version agk2, v 2.0.16 with windows 8.1
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 5th Jan 2016 19:25
I've had exactly this with GetFirstFile. My feeling is that these commands should have an input that allows you to dictate what "first" means - date, name of file, last modified etc
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 6th Jan 2016 02:14 Edited at: 6th Jan 2016 02:16
i think it is returning the VTOC order, not sorted order. if you copy the files/folders into the folder in the order in which you want to read them then i think it will work. not a very robust solution though
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 6th Jan 2016 11:55
Hi DavidAGK
Quote: "I've had exactly this with GetFirstFile"

That worried me as I will have a lot more files than folders when I finish and the getting of file/folder order is currently poor. I totally agree with your thoughts about providing these commands with an input to dictate the getting order but I would have at least expected alphabetic order to be mandatory.
I hope Paul gets a chance to view this as this would be a great help.

Hi blink0k
Quote: "VTOC order"

Have to confess I am not familiar with this terminology but have tried copying in order I want to read but without success, still reverse alphabetical regardless. I don't think it would be very practical for me either, but thanks.

Thank you both for your comments, back to the drawing board unfortunately!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 6th Jan 2016 22:25
I'm sorry that didn't work (I was sure tht worked for me in my previous project but my mind must be going ). I guess your up for sorting an array.
Not too bad with the V2 array changes: myArray.sort()
http://www.appgamekit.com/documentation/guides/12_array_changes.htm
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 7th Jan 2016 13:04
@ blink0k, thanks again and yes my only options to date are to use arrays or abandon.
I have found 3 array options that will work, sort, reverse or simply assign my data to each array cell using a bit of maths to reverse the cell numbers. The first 2 methods, and when I say first, I mean sort or reverse array, just in case there is any confusion of which order of methods I refer, both add a small time delay so the last method seems to be the best at the moment.
eg instead of assigning cell numbers by;


This should make cell no 1 = A through to cell no 26 = Z.
(I haven't even started on several hundreds of files yet which will have the same problem).

The biggest problem though for me is if and when we get an update to make the getfirst more logical and default it to alphabetical order. Then it will mean re-writing quite a large chunk as this windows app which is primarily to do with folders and files. Some PJ feedback would be appreciated.
So, do I abandon, postpone or just go back to DBPro where IanM matrix is great?
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 7th Jan 2016 14:31 Edited at: 7th Jan 2016 14:36
change to:
for letter = 1 to 26
alphabet[27-letter] = fn$
etc

I keep trying to reply to this post, but haven't quite managed it (until now of course). I just don't get the issue. Does it matter what order those commands return the folders/files? Also, if you know the structure of the folders and files, then surely you don't need to use those commands at all right? I thought they were for when you don't know what files/folders are there.
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 7th Jan 2016 14:58
Quote: " I just don't get the issue"


Its impossible for everyone to guess how someone needs their program to work, so I am not surprised, but if it didn't matter I wouldn't be asking the question in the first place.

The command getfolderfirst() doesn't qualify what criteria it uses to obtain the first folder. I would like to know if getting the order reverse alphabetical is normal, is it an error or what.

My app is for a client who has variable folders, details of which and details of variable sub-folders need to be displayed alphabetically on screen. So yes I know the structure but I also need to use those commands.

Hope that helps with your curiosity.

Anything that will further help with my query would be appreciated.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 7th Jan 2016 15:49
I have no idea if this would be any faster, but you can insert elements into an array in any position you like. i.e.:



V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 7th Jan 2016 16:16
@CJB, that's very impressive and fast, thank you.

I still have the concern though in that" Is getfirstfolder() and getfirstfile() meant to work in reverse alphabetical order or is it an error?". It just seems illogical to work in reverse to me.
If it is correct then I can check the speed of your coding against the speed of mine and employ with confidence the better of the two.
However if the way it works is an error and could be changed shortly to either be corrected and/or for the addition of extra input options as suggested by DavidAGK, then I could do with a time scale to see how long I may have to wait before being able to apply any corrective work if I proceed as is. But I guess only PJ can answer that one.

Thank you again though for your input, appreciated.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 7th Jan 2016 20:25
Quote: "Is getfirstfolder() and getfirstfile() meant to work in reverse alphabetical order or is it an error?"

It is an oversight on my part, the folders are read in alphabetical order but are placed in a linked list, which reverses the order when they are read back out. I won't change the functionality of the existing command, but I may add an optional parameter to sort the results differently in future.

Login to post a reply

Server time is: 2024-11-25 13:47:46
Your offset time is: 2024-11-25 13:47:46