Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

I need our postcode to display in the correct order. I've broken the first part down into 2 fields so I can sort on the text and numbers, but I need to sort the second part of the postcode too.

The UK postcode format is usually TTNN TNN, however then first part can consist of just one letter or just one number. There is always a space in between the two parts.

Posted

What I was thinking of doing was breaking the poscode field into 4 different calculated fields. So the text field, Poscode holding BR23 7TB would become...

BR (text field)

23 (numeric field)

7 (numeric field)

TB (text field)

I could then sort on these fields to ensure the actual postcode field in sorted correctly.

Posted

You haven't answered my question.

The correct order for BR23 3TU would be..

BR - ascending

23 - ascending

3 - ascending

TU - ascending

This would ensure that BR1 is not followed by BR12 but BR2 etc. and the same for the second part of the postcode.

Posted (edited)

OK, then wouldn't it be sufficient to insert a zero after the first one or two alpha characters when they are followed by a single digit? That is "BR12 3TU" would remain unchanged, while "BR1 3TU" would be turned into "BR01 3TU".

Edited by Guest
Posted

I am afraid I don't follow you. What would be the purpose of breaking it into four calculation fields, when it can be done by a single one? Not to mention that sorting by one field is more efficient than by four separate ones.

Posted (edited)

I presume what comment is getting at is that you don't need 4 additional fields. You only need one, Post Code Sort. That field will have the calculation that will return the post code in a sortable format.

It's not clear how a single letter in the first part of the code should sort, but I'd assume it should sort above any double letter. B23 sorts before BA11?

Let([

PostCode = Upper(table::field);

first = LeftWords(PostCode;1);

second = Rightwords(PostCode;1);

lets = filter(first;"ABCDEFGHIJKLMNOPQRSTUVWXYZ");

lets = Left(lets & 0;2);

nums = filter(first;"0123456789");

nums = Right(0& nums;2);

result = lets & nums & second

];

result

)

PS: Got distracted and posted later than I intended...This was in response to post #341074.

Edited by Guest
Posted

Sort order is back up the thread.

The correct order for BR23 3TU would be..

BR - ascending

23 - ascending

3 - ascending

TU - ascending

This would ensure that BR1 is not followed by BR12 but BR2 etc. and the same for the second part of the postcode.

Posted

I believe DJ's calculation should provide that. If you're seeing something else, it may be due to incorrect implementation (make sure the result type is Text) or something that I am missing. If the latter, I will keep missing it unless you show it me.

This topic is 5599 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.