Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Juggernaut

GetFields sorted by the layout

Featured Replies

  • 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!

I think you will find that they are in creation order. Not sure if you can influence this during the getFields() at all...

  • 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.

  • 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

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

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...)

  • 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!

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().

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..."

  • Author
  • Newbies

Thanks for your correction webko. I am still improving my english.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.