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.

possible Sorting with If Then?

Featured Replies

I need to be able to sort by two methods. I'll try to explain only my isolated problem.

I have one type field set to be either A-E with multiple values possible. The other field is a title.

I want to sort by type A,B,C,D, or E then by alphabetical title name. However, if the record type contains a C, I want it to sort by title only, not by type. The reason is because I have a series of information that needs to be shown in a sequential order. An example follows. Any suggestions?

Senators of the Nation - Type A

Typecasting - Type A

Ah Quon McErath, A Hero's Story - Type A

Unit 1 - Type C,D

Unit 2 - Type C,F

Unit 3 - Type C,E

Unit 4 - Type C,D

Unit 5 - Type C,F

An American Tradition - Type A

Lowering the Barriers - Type A

Unit 6 - Type C,F

Unit 7 - Type C,E

So, it sorts out as:

Ah Quon McErath, A Hero's Story - Type A

An American Tradition - Type A

Lowering the Barriers - Type A

Senators of the Nation- Type A

Typecasting - Type A

Unit 1 - Type C,D

Unit 4 - Type C,D

Unit 3 - Type C,E

Unit 7 - Type C,E

Unit 2 - Type C,F

Unit 5 - Type C,F

Unit 6 - Type C,F

Well, I would say create a calculated text field of Case( not Position( Type, "C", 0, 1 ), Type & " " ) & Title, and sort by this field. But your example doesn't seem to demonstrate your desire. Why does Unit 4 sort before Unit 3, etc.?

  • Author

Thanks. I want it to sort as:

Ah Quon McErath, A Hero's Story - Type A

An American Tradition - Type A

Lowering the Barriers - Type A

Senators of the Nation- Type A

Typecasting - Type A

Unit 1 - Type C,D

Unit 2 - Type C,F

Unit 3 - Type C,E

Unit 4 - Type C,D

Unit 5 - Type C,F

Unit 6 - Type C,F

Unit 7 - Type C,E

But it's sorting as my example in my initial post instead. Right now, the sort function is simply Sort by Type, ascending, then Sort by Title, ascending.

Will your calculation allow me to sort by alpha if anything other than "C" is contained in the type field?

Yes, If Type contains the letter C, then it won't appear in the calc field, but the Title will. If it doesn't contain C, then both will appear.

  • Author

Thank you. Thank you! This worked beautifully. Now I need to work on understanding why it worked! Much mahalo.

Position( Type, "C", 0, 1 ) returns either zero or the position of C in Type. If it's zero, then 'not Position( Type, "C", 0, 1 )' is true, since 'not X' is equivalent to 'X = 0'. So if the result is zero and, therefore, not Position( Type, "C", 0, 1 ) is true, the calculation will return Type, followed by a space. In either case it will return the Title, but only if C is not present in Type will it return the Type and a space.

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.