Jump to content
Server Maintenance This Week. ×

Create a custom sort window


This topic is 4013 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi folks, I've been searching everywhere for a solution to what I am trying to accomplish and have not found one anywhere, so was hoping someone out there would be able to help.

 

I am trying to create a custom sort in a solution. As in allow the user to choose any number of column headings and be able to sort in whatever order they wish. Now I know this is what you can do when you click the sort button. However, I don't want the user to use Filemaker's sort window as it will get very confusing for them to try and figure out some of the field names.

 

My thought process so far is that I can create a couple of side by side portals that basically mimic the sort box. All the column headers would start in the left portal and they could click on a portal line to move it to the right portal. They can then move portal lines up and down within the right portal via arrows on each line until they end up with the sort fields in the order they want to sort in the right hand portal. However this is as far as I can get! I can't figure out a way to turn it into a sort. I know I have two options, using a value list to define the sort or a summery field. I'm pretty sure with the research I have done that I can define a value list that will be in the same order as my sort list. However, if I sort by this value list would that work, or does a sort by value list only work if the exact sort is the value list itself (for example a list of days of the week)?

 

I should also mention I have considered creating a script that includes every possible variation of how the columns can be sorted, but I have around ten columns, and gave up counting possible sorts after reaching well over fifty with just four columns!

 

I am worried this may be one step too far for me. I'm not even sure it is possible.

 

I very much hope someone can wrap their brain around this (if it even makes sense) and can help.

 

James

Link to comment
Share on other sites

there are a number of solutions out there for dynamic portal sorting - basically creating title fields that you set at the top of the portal and scripting them as buttons to sort when they are clicked - no need for 2 portals.

 

here is one --  http://www.filemakerhacks.com/?p=1284

 

 

there are others - just do a search for dynamic portal sorting

 

hth,

Martie

Link to comment
Share on other sites

I'm working on building a Virtual Sort module that you might be able to use achieve the effect you want. It's not quite ready for distribution yet — it still needs some refactoring, documentation, and demos — but it does work. It's basically a more robust implementation of mr_vodka's portal sort described on FileMaker Hacks. It wont work on FileMaker 10 though; you'd need version 12 for the ExecuteSQL function.

 

Just to clarify, Virtual Sort works with found sets, too, not just portals.

Edited by jbante
  • Like 1
Link to comment
Share on other sites

Is there a way to actually download your virtual sort module? Clicking the link on the destination page only downloads an HTML document, not a FileMaker file.

Link to comment
Share on other sites

James, it's an interesting idea, but beware the Inner-platform effect.

 

Consider using more "natural" names for your fields. Your script could then go to a layout with only the fields you wish the user to use for sorting, then pop up the Sort dialog. By default, it shows only the fields on the current layout.

 

Just sayin'.

 

(@Martie, I don't think he's talking about sorting a portal -- he's talking about building a UI, using portals, to mimic the FileMaker Sort dialog's functionality.)

  • Like 1
Link to comment
Share on other sites

Thanks for the replies folks. Fitch, you are right, I am not talking about sorting a portal, although I can't foresee an issue with making the layout basically one big portal if need be. Jbante, unfortunately the company I am creating the solution for uses Filemaker 10, and I couldn't convince them to pay to upgrade to 12, so I'm stuck creating the database in 10. Fitch, you are of course right about the field names. My problem has come because there are a number of other databases that pull information from this one, and I am basically replacing a current database for the company. The one rule they really gave me was that the field names need to remain the same so the exports still work as is. So I am stuck with someone elses field names that don't make a great deal of sense! The Inner-Platform effect article was a really interesting read, and it made me laugh as you're right, it is exactly what I am doing! However, in this particular case I can't see a way around it, as the Sort Script step only lets you predefine the sort if the Sort box is not shown.

 

Wonder if anyone had an answer for the value list question, which I asked poorly above. When you sort by a value list, does the sort take each line in the value list, sort by it and go to the next line, or does it sort by the entire list in one go?

Link to comment
Share on other sites

If you have a value list:

spoon

fork

spork

 

Then those records with matching values will be sorted, e.g.

spoon

spoon

fork

spork

spork

spork

 

All other records will sort below the ones that match the value list items.

 

Does that answer your question? I don't really know what you're getting at. I'm sure you can "sort" it out yourself with a quick experiment or two.

Link to comment
Share on other sites

Another suggestion for a compromise solution: offer single-field sorting for each column, which would generally satisfy the majority of users' needs, and give them a separate "custom sort" button for those that require it. With only 10 (or even 20) columns, I wouldn't think the Sort dialog THAT confusing, no matter how weird your field names are.

Link to comment
Share on other sites

This topic is 4013 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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