Newbies Timeodan Posted June 12, 2012 Newbies Posted June 12, 2012 Hi Folks I'm creating an export function for users, where they can choose (over an website) a layout and then appears a list with all fields inside this layout. The user now chooses which fields he would have in the export. The problem is the listing of the fields seems to be random. Is it possible to influence this order? An example: I have a layout with data of clients like name, phone, adress, email etc. So I get these fields with the getFields() function. But I like to have them in a certain order, so when i get the single fields out of the array in the order of: Name, Adress, Phone, Mail etc. Thank you very much for your help!
webko Posted June 12, 2012 Posted June 12, 2012 I think you will find that they are in creation order. Not sure if you can influence this during the getFields() at all...
Newbies Timeodan Posted June 13, 2012 Author Newbies Posted June 13, 2012 Thanks for your help. As soon as possible I will check this out. The problem is I work with an existing Database with hundreds of fields and I don't know when which fields were created.
Newbies Timeodan Posted June 14, 2012 Author Newbies Posted June 14, 2012 I have tried it and it's like webko assumed: The order of the fiels depends on the creation order. Has anybody an idea how I can influence this order? Thanks
webko Posted June 17, 2012 Posted June 17, 2012 Well, if they come back in some sort of array structure, then you should be able to sort the array for presentation: http://php.net/manual/en/array.sorting.php
David Jondreau Posted June 18, 2012 Posted June 18, 2012 In Manage Database...under the Fields tab, you have the choice of how to view the fields. The default is Creation Order, but you can choose "Custom Order". You can reorder the fields anyway you'd like and that re-ordering will also show on most of the field list dialogs (including Export...)
Newbies Timeodan Posted June 19, 2012 Author Newbies Posted June 19, 2012 I do the export over php. First of all, the possible fields have to be listed, so the user can choose the needed ones. But the order of these fields is in creation order, even if I change the custom order. (I get the field names with the function getFields() ) I think there is no other way to sort the fields with arrays as webko wrote. Thanks for the replies!
David Jondreau Posted June 19, 2012 Posted June 19, 2012 Ah, sorry, missed the whole context there. Don't see why webko's advice wouldn't help. Or just hardcoding the field names into the PHP, skipping GetFields().
webko Posted June 20, 2012 Posted June 20, 2012 I suspect the line "I think there is no other way to sort the fields with arrays..." should read "I think there is no way other than to sort the fields with arrays..."
Newbies Timeodan Posted June 22, 2012 Author Newbies Posted June 22, 2012 Thanks for your correction webko. I am still improving my english.
Recommended Posts
This topic is 4830 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now