June 12, 201213 yr Newbies 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!
June 12, 201213 yr I think you will find that they are in creation order. Not sure if you can influence this during the getFields() at all...
June 13, 201213 yr Author Newbies 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.
June 14, 201213 yr Author Newbies 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
June 17, 201213 yr 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
June 18, 201213 yr 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...)
June 19, 201213 yr Author Newbies 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!
June 19, 201213 yr 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().
June 20, 201213 yr 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..."
Create an account or sign in to comment