Author Topic: Images not sorting correctly  (Read 364 times)

cassb

  • New Members
  • *
  • Posts: 33
Images not sorting correctly
« on: June 26, 2020, 06:06:19 PM »
I created a new sort by the Image.Date attribute, so that my images should sort by the date I assign them.  But for some reason, I get 1/2 of the images sorted by date, then the second 1/2 starts again at Jan 1 and sorts the rest of the images.  See attached screen shot - the selected image in red is where the sort restarts.  Why don't all the images in the same folder sort by date?

Thanks!

Jingo

  • Super Hero
  • ****
  • Posts: 1583
Re: Images not sorting correctly
« Reply #1 on: June 26, 2020, 06:31:13 PM »
"Image.Date" is an attribute that you created?  Perhaps the sort is using the date order months of 1, 10, 11, 12, 2, 3, 4, 5, 6, 7, 8, 9?

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 25817
Re: Images not sorting correctly
« Reply #2 on: June 26, 2020, 07:14:40 PM »
If the Attribute is a Date or DateTime attribute, it should work.

cassb

  • New Members
  • *
  • Posts: 33
Re: Images not sorting correctly
« Reply #3 on: June 26, 2020, 07:38:24 PM »
Yes Mario, it's a Date type attribute.  I agree that it should work as well, but it's not and I cannot figure out why.  Can you direct me where to check to troubleshoot?  I'm a C# programmer, so you can talk programmer lingo.  :-)

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 25817
Re: Images not sorting correctly
« Reply #4 on: June 26, 2020, 07:52:00 PM »
The date you are showing in the File Window, is that your Attribute? Or the standard Date & Time IMatch maintains for each file?

cassb

  • New Members
  • *
  • Posts: 33
Re: Images not sorting correctly
« Reply #5 on: June 26, 2020, 08:00:32 PM »
It's the Image.Date attribute that I created and am trying to sort by.  Here's the whole window with the attributes at the bottom.

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 25817
Re: Images not sorting correctly
« Reply #6 on: June 27, 2020, 09:25:36 AM »
Works here.
I've created an Attribute of Type Date in my Notes set and filled it with dates between 1963 and 2020.
I've created a File Window layout with a custom template which shows the contents of the "Notes.Date" Attribute I have created.



I've then created a sort profile using Notes.Date and File Name (smart).

IMatch sorts the files correctly.



Date Attributes are stored internally in standard ISO YYYY-MM-DD format, which makes them 'sortable' automatically. Only for display and input purposes the local date format is used.
I don't see how this could fail.
« Last Edit: June 27, 2020, 10:29:41 PM by Mario »

Carlo Didier

  • Super Hero
  • ****
  • Posts: 1491
Re: Images not sorting correctly
« Reply #7 on: June 27, 2020, 10:24:06 PM »
Could it be that somehow you didn't fill out the attribute the same way for all the files?

cassb

  • New Members
  • *
  • Posts: 33
Re: Images not sorting correctly
« Reply #8 on: June 29, 2020, 02:29:57 AM »
Could it be that somehow you didn't fill out the attribute the same way for all the files?

I don't think so... a Date type attribute will only allow valid date input.  I have no idea why the folders sort into two different data sets.

sinus

  • Global Moderator
  • *****
  • Posts: 4028
  • IMatch-User since 2001 (IMatch 3.6)
Re: Images not sorting correctly
« Reply #9 on: June 29, 2020, 10:02:09 AM »
Could it be that somehow you didn't fill out the attribute the same way for all the files?

I don't think so... a Date type attribute will only allow valid date input.  I have no idea why the folders sort into two different data sets.

At least I had several times the case, that I did fill in some Attributes and ended with empty fields (simply empty).
In all cases it was a user-error, means my own fault.  8)

Just to add this, that this can happen, this means not, that it is the case here.  :)
Best wishes from Switzerland! :-)
Markus

cassb

  • New Members
  • *
  • Posts: 33
Re: Images not sorting correctly
« Reply #10 on: June 29, 2020, 02:28:13 PM »
Mario, what can I do to further troubleshoot the issue.  Is there a log file or can I turn on some kind of trace code that will show how it's sorting the thumbnails?

thrinn

  • Hero Member
  • ***
  • Posts: 792
Re: Images not sorting correctly
« Reply #11 on: June 29, 2020, 03:47:04 PM »
I also tried to reproduce it with my test database, but the thumbnails sort correctly. Just some ideas (aka wild guesses):
  • The date shown in the thumbnail display (in orange, below the filename) is definitely the Image.Date attribute? Your file windows layout is configured to show a "Custom Template" with "{File.AT.Image.Date}"? (See Mario's answer for reference)
  • Does this only happen for specific filenames? To explain: your sort profile sorts first by Image.Date attribute (in descending order), then by Filename (in descending order). From your screen shots I take it that you reversed the order (because the icon right to the sort profile select box is activated). Therefore, the pictures should sort in ascending order, correct? I also understand that, at least in you screen shots, the wrongly sorted files seem to start where your file names change: from 1963-13-nn to 1963-MISC-nn. Not sure if this makes a difference, for me it worked nevertheless.
  • What happens if you change the sort profile to only sort by the Image.Date attribute, without a second level (filename)? Does this make a difference?
  • I assume you did run a DB diagnostics, just in case?
Thorsten
Win 10 / 64, IMatch 2018, IMA

sinus

  • Global Moderator
  • *****
  • Posts: 4028
  • IMatch-User since 2001 (IMatch 3.6)
Re: Images not sorting correctly
« Reply #12 on: June 29, 2020, 04:08:47 PM »
The same here.
I tried it and it works fine.
It could be, that the sort-profile is not set correct, but of course this is also a wild guess.
Best wishes from Switzerland! :-)
Markus

cassb

  • New Members
  • *
  • Posts: 33
Re: Images not sorting correctly
« Reply #13 on: June 29, 2020, 05:53:48 PM »
Thank you -- I just did a Database Optimize... no change.  But I did discover an interesting thing.  If I change the File.AT.Image.Date attribute on an image to the SAME date, nothing changes.  However, if I delete the date or change it to a different date, THEN the file becomes sorted into the second group in my layout.  Weird.  So the first group of files in the layout maybe has a different way of internal date storage and when I change that date, it gets stored as the 'new' way?

I'm not going through all 13,000 of my photos and reset the dates on each one individually - I'll need to write a script or something to run through the database.  This must be a result of a combination of the custom layout I have and how the dates are stored.  I'll try creating a new layout, but my test leads me to believe that there's an internal date storage issue.

FYI, I have been an IMatch user for over 18 years so my database has gone through many upgrades.  Maybe one of the upgrades changed the internal date format or something and some of my files didn't get converted?

cassb

  • New Members
  • *
  • Posts: 33
Re: Images not sorting correctly
« Reply #14 on: June 29, 2020, 06:03:01 PM »
Yes... I confirmed after creating a new File Layout using the same File.AT.Image.Date in the layout and using that as a sort parameter that I still get two distinct groups of sorted data.  There must be something different in how the File.AT.Image.Date is stored for these two groups.  I wish I could look at the database fields somehow...  I'm not sure what the db engine is for this software - maybe SQL Server?  Mario, can I use SSMS to open it, or is the database password protected?  Otherwise, can I sent you the db file somehow and maybe you can see if the dates are stored differently?

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 25817
Re: Images not sorting correctly
« Reply #15 on: June 29, 2020, 06:44:59 PM »
Check your file Window settings. According to your screen shot you are reversing the sort order, and you display hierarchies, one or more levels deep.
Check if any of these settings make a change.

cassb

  • New Members
  • *
  • Posts: 33
Re: Images not sorting correctly
« Reply #16 on: June 29, 2020, 07:40:54 PM »
I deleted the existing Date Attribute sort order and recreated it again with its default setting as reverse sort order and only one level deep.  Still two different sorted sets of data in one folder.

I circled in red the three files where I deleted and re-entered the File.AT.Image.Date attribute and they moved into the second sorted group.

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 25817
Re: Images not sorting correctly
« Reply #17 on: June 29, 2020, 07:55:40 PM »
No idea, sorry.
It works here, it works for several other users who tested this this to help.

I would need your database here and analyze it.
Which is very expensive (time-wise) and also will take a couple of weeks.
Because my "Problem affecting one user only and requires extensive analysis" queue is full and has a lower priority. I hope you can understand that.
You can upload your database and send me a link to support email address.

Tip:
Try to reproduce this effect with a new database. Just add this one folder and your dates.
If this is reproducible with a smaller database, you can send it to me ZIPped and I might be able to reproduce this here. And then fix it, if it is a bug.

cassb

  • New Members
  • *
  • Posts: 33
Re: Images not sorting correctly
« Reply #18 on: June 29, 2020, 08:01:31 PM »
OK Mario, will do.  Thank you for all your work, especially if this is still a hobby for you and not your full-time job!  :-)

cassb

  • New Members
  • *
  • Posts: 33
Re: Images not sorting correctly
« Reply #19 on: June 29, 2020, 08:04:03 PM »
Maybe someone could help me with a script that will temporarily save and then delete the File.AT.Image.Date attribute, and add it back to the file again.  That should work and I could try it on a few files to start with.

thrinn

  • Hero Member
  • ***
  • Posts: 792
Re: Images not sorting correctly
« Reply #20 on: June 29, 2020, 10:25:01 PM »
Maybe you don't need a new App for this. What about the following approach (just thinking aloud):
  • Create a second per-file attribute set with a new Date attribute.
  • Use the Attribute Importer which you find in the Import/Export panel to copy the contents from Image.Date to the 2nd attribute set.
  • Check if a sort profile using the 2nd attribute set works correctly.
  • Delete the Image.Date attribute. Recreate it.
  • Copy back the saved dates from the 2nd attribute set.
I did not try it out, but maybe it is worth a try?

Of course, backup your database first and check on a few images if this approach works at all.
Thorsten
Win 10 / 64, IMatch 2018, IMA

cassb

  • New Members
  • *
  • Posts: 33
Re: Images not sorting correctly
« Reply #21 on: June 29, 2020, 11:41:50 PM »
Good idea, thank you!  I am going to first find out how many files have this issue... if it's only a couple hundred, I'll just manually change the date on all of them.  If it's 1000s, then I'll consider the automated idea.