Page 1 of 2 12 LastLast
Results 1 to 15 of 20

Thread: Sort on Add

  1. #1
    Join Date
    Apr 2013
    Posts
    226

    Unanswered: Sort on Add

    Hi,

    Does anyone have any ideas for forcing a folder to sort (e.g. on name) when a new record is added? I know you can sort on folder click, but when adding a new record within a form with a relationship to the folder (when you click on the field with a relationship and choose New) it just gets added to the end of the list. So next time you add this way, the new records are at the bottom. I have looked at all possible configurations (for folders and in the design area) and can't find anything that works.


    Thanks

    Matty

  2. #2
    Join Date
    Jul 2012
    Location
    Ireland
    Posts
    815
    Provided Answers: 17
    I'm not sure I understand your question.
    Are you trying to sort records assigned to a many to many field?

    If so, see attached image. You can right click on your many to many field and then select configure appearance. Once you do, you will see the attached window.

    Regards
    James
    Attached Thumbnails Attached Thumbnails screen.jpg  

  3. #3
    Join Date
    Apr 2013
    Posts
    226
    Quote Originally Posted by Tubbritt View Post
    I'm not sure I understand your question.
    Are you trying to sort records assigned to a many to many field?

    If so, see attached image. You can right click on your many to many field and then select configure appearance. Once you do, you will see the attached window.

    Regards
    James
    Hi James,

    This is a one to many. I have individual items that are assigned to a customer. An item can only be assigned to one customer but one customer might have many items. So I have a field on the item record that links to the customer record (I use e-mail address). Sometimes the customer doesn't exist, so I right click on the relational field and choose to create a new customer. When that customer is added they go to the bottom of the table which will never get sorted unless I go to the customer table and sort it there. Does that make sense? I tried the setting you mentioned but I think what that does is order the relational field when there is more than one entry in it, which there never is in this case.

    Matty

  4. #4
    Join Date
    Jul 2012
    Location
    Ireland
    Posts
    815
    Provided Answers: 17
    So you want to sort records in another folder “IF” you add a new record to that folder from inside the “One to Many” field on a different form ?

    If I understand correctly, please let me know and I can explain how you do that.

    Regards
    James.

  5. #5
    Join Date
    Apr 2013
    Posts
    226
    Quote Originally Posted by Tubbritt View Post
    So you want to sort records in another folder “IF” you add a new record to that folder from inside the “One to Many” field on a different form ?

    If I understand correctly, please let me know and I can explain how you do that.

    Regards
    James.
    Yes correct. You managed to say in one short sentence what I took a whole paragraph of waffle to not say!

  6. #6
    Join Date
    Jul 2012
    Location
    Ireland
    Posts
    815
    Provided Answers: 17
    Try this....Given some sleep I'm sure I could come up with better ways.

    Anyway...open the attached database. As you can see when you open this the Contacts are not in alphabetical order.

    Go to the One 2 Many folder and add right click to create a new record in the relation field.

    Now have a look at the contacts folder. It should be in alphabetical order.

    Regards
    James
    Attached Files Attached Files

  7. #7
    Join Date
    Dec 2012
    Location
    Huntsville, AL
    Posts
    379
    Provided Answers: 2
    James,
    Excellent! I, too, have been wondering how to do this. Your succinct solution will work perfectly for my situation (and I hope that it serves Matty as well!)
    Daryl G

  8. #8
    Join Date
    Apr 2013
    Posts
    226
    Quote Originally Posted by Tubbritt View Post
    Try this....Given some sleep I'm sure I could come up with better ways.

    Anyway...open the attached database. As you can see when you open this the Contacts are not in alphabetical order.

    Go to the One 2 Many folder and add right click to create a new record in the relation field.

    Now have a look at the contacts folder. It should be in alphabetical order.

    Regards
    James
    Thanks. I can't get it working for my database though. What I can see you've done is add an "on edit" script to the relationship field which sorts contact records on edit. Is there anything else I've missed? What does the line [$count check] = folRecN(1073) do?

    Thanks

    Matty

  9. #9
    Join Date
    Apr 2013
    Posts
    226
    On further investigation, what it is doing for me is sorting the items folder by the surname of the contact associated with that item. It isn't sorting the contacts folder. I may have to put together a demo database of what I'm trying to do.

  10. #10
    Join Date
    Jul 2012
    Location
    Ireland
    Posts
    815
    Provided Answers: 17
    Is there anything else I've missed?
    Yes, go to the contacts folder and view it's properties. On folder select, if the $count check contains a 1, then it will sort all the records in that folder and reset the count check to 0.

    You can choose here what way the records get sorted.

    The $count check is assigned a value of 1 only when you add a new record from inside the one to many field.

    FolRecN(1073) is just the ID number of the Contacts folder. Brilliant Database does that when you select folders.

    Regards
    James.

  11. #11
    Join Date
    Apr 2013
    Posts
    226
    I've just got around to looking at this in detail, and I just can't get this to work. With the example you attached, if I create a new contact via the one to many field, it is not sorted in the contacts folder and nor is the list of names sorted when I go to add another contact via the one to many field. The new contacts are just shown at the bottom in the order created. I'm lost now!

    Matty

  12. #12
    Join Date
    Jul 2012
    Location
    Ireland
    Posts
    815
    Provided Answers: 17
    Hi Matty.

    It's working fine for me. If you look at the folder properties for Contacts, line 2 of the code is set to sort by first name only. If you want it sorting by a full name, you need to modify this.

    Beyond that method of sorting, everything seems to be working fine.

    Regards
    James

  13. #13
    Join Date
    Apr 2013
    Posts
    226
    Hi

    Yes I'm looking at firstname. But nothing is sorted. Strange.

  14. #14
    Join Date
    Jul 2012
    Location
    Ireland
    Posts
    815
    Provided Answers: 17
    Hi Matty.
    Try these steps.

    Go to the many to many folder, and right click on the many to many field.
    Select “new contact”
    Give this contact any first name you like.
    Press Save.

    Now click on the contacts folder. Everything displayed in there should be in alphabetical order.

    Does that help?

    Regards
    James

  15. #15
    Join Date
    Apr 2013
    Posts
    226
    That's what I was doing. They aren't in alphabetical order. I will start again from scratch with a new download tomorrow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •