Author Topic: Sorting using a Custom Field during export.  (Read 15758 times)

0 Members and 1 Guest are viewing this topic.

Offline John666

  • Member
  • *
  • Posts: 28
  • Who wants to live for ever?
    • View Profile
Sorting using a Custom Field during export.
« on: October 08, 2011, 11:23:31 pm »
In the %OPTIONS% section at the beginning of the template files there is an entry for ‘sortby=’. My question is… How do I sort on a custom field?

I have tried everything I can think of but all that happens is the output is sorted by some other method, I assume the ID.

Is this possible or have I been wasting my time trying?
Windows 7 (64bit)
PVD v1.0.2.7

Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: Sorting using a Custom Field during export.
« Reply #1 on: October 09, 2011, 12:34:04 am »
It is not possible
Gentlemen, you can’t fight in here! This is the War Room!

Offline John666

  • Member
  • *
  • Posts: 28
  • Who wants to live for ever?
    • View Profile
Re: Sorting using a Custom Field during export.
« Reply #2 on: October 09, 2011, 08:14:06 am »
Thanks for letting me know. Is it something that will be implemented in the new release?

Just another thought... Is it possible to copy the information I have entered into the custom field over to a standard field, for example I don’t use the Barcode field.

I have over 1000 entries and it would take hours to go and modify all of them manually.

And, is it possible to sort by more than one field in templates, so that you have a primary and secondary sort in differing directions?
« Last Edit: October 09, 2011, 08:46:54 am by John666 »
Windows 7 (64bit)
PVD v1.0.2.7

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Sorting using a Custom Field during export.
« Reply #3 on: October 09, 2011, 09:39:29 am »
Quote
Just another thought... Is it possible to copy the information I have entered into the custom field over to a standard field, for example I don’t use the Barcode field.

Yes. Export the custom field (along with Title and Year to identify the record), then import it to Barcode.

Offline John666

  • Member
  • *
  • Posts: 28
  • Who wants to live for ever?
    • View Profile
Re: Sorting using a Custom Field during export.
« Reply #4 on: October 09, 2011, 09:56:55 am »
Quote
Yes. Export the custom field (along with Title and Year to identify the record), then import it to Barcode.

Thanks, that will save me a lot of time.

Any suggestions on sorting by more than one field in templates?

What I am trying to do is first sort by the contents of the 'Barcode' field and then by 'Title'.

The reason for this is that I am using the Barcode field to group specific types of records but I want them to be sorted by title within the groups.

If I just sort by the barcode field the titles are out of order.
« Last Edit: October 09, 2011, 10:29:15 am by John666 »
Windows 7 (64bit)
PVD v1.0.2.7

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Sorting using a Custom Field during export.
« Reply #5 on: October 09, 2011, 12:02:50 pm »
If you're just using Barcode as a sort key, use Excel to append Title to Custom, and import that to Barcode.

Offline John666

  • Member
  • *
  • Posts: 28
  • Who wants to live for ever?
    • View Profile
Re: Sorting using a Custom Field during export.
« Reply #6 on: October 09, 2011, 12:12:29 pm »
If you're just using Barcode as a sort key, use Excel to append Title to Custom, and import that to Barcode.

Yes, I thought of that, but every time I enter a new record I would have to do the same thing and that would be very time consuming.

Is it a feature that is likely to be added to the new version?
Windows 7 (64bit)
PVD v1.0.2.7

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Sorting using a Custom Field during export.
« Reply #7 on: October 09, 2011, 12:23:30 pm »
Quote
Is it a feature that is likely to be added to the new version?

Only nostra sees the future. Seems like a rather obscure thing to me, but you haven't described the application.

Offline John666

  • Member
  • *
  • Posts: 28
  • Who wants to live for ever?
    • View Profile
Re: Sorting using a Custom Field during export.
« Reply #8 on: October 09, 2011, 12:59:02 pm »
It's a bit complicated, but here goes.

I am using the 'Release' field for storing UK Certifications e.g. 'U', 'PG', '12A' etc.
The reason for using the Release field is so that it appears in the List, formatted as '%T (%Y) %R' giving me 'Avatar (2009) 12A'.

I then found that if you sort by the Release field it sorts it into 12, 12A, 15, 18, PG, U which is out of age order.
I now use the 'Barcode' field in addition and enter 10 for U, 20 for PG, 30 for 12A, 40 for 12, 50 for 15 and 60 for 18.

This means that I can now sort the Certification correctly for output to a web page. The problem still remains that the names are out of sequence.
I have tried re-indexing the database but this does not help either.

Take a look at the images; maybe they can explain it better.

I also need to do this with the Year and IMDb Ratings so that my individual lists would appear as follows
    Type           Sort By        List Output
    Normal        Title             Avatar
    Cert            Barcode        12    Avatar
    Rating         IMDb            8.1   Avatar
    Year            Year             2009  Avatar

I have got all of these working, apart from the seemingly random order of the titles except where the title is the sort field.

[attachment deleted by admin]
« Last Edit: October 09, 2011, 04:57:42 pm by John666 »
Windows 7 (64bit)
PVD v1.0.2.7

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Sorting using a Custom Field during export.
« Reply #9 on: October 09, 2011, 10:20:43 pm »
Have you considered using HTML Frames export template? Maybe svenne could add the filters you require, or explain a technique for doing something similar in your template.

[attachment deleted by admin]

Offline John666

  • Member
  • *
  • Posts: 28
  • Who wants to live for ever?
    • View Profile
Re: Sorting using a Custom Field during export.
« Reply #10 on: October 10, 2011, 12:12:20 pm »
WOW, thanks for that. I have been having a look at it for hours now. It's way over my head but a good place to start.

Thanks.
Windows 7 (64bit)
PVD v1.0.2.7

Offline handytouch

  • Member
  • *
  • Posts: 3
    • View Profile
Re: Sorting using a Custom Field during export.
« Reply #11 on: December 27, 2011, 04:13:07 pm »
Hi John,

How did you manage to pull the certification into PVD? I am trying that as well to pull Certification: Singapore as well.

Offline John666

  • Member
  • *
  • Posts: 28
  • Who wants to live for ever?
    • View Profile
Re: Sorting using a Custom Field during export.
« Reply #12 on: December 27, 2011, 11:12:40 pm »
Hi, sorry to disappoint. I entered the certificate info myself into the ‘release’ field but it could have been any custom field.

The easiest way if you have a lot of them is to export them to a .csv file, edit the appropriate field content and then import the changes. You must remember to include the record ID as one of the import/export fields.

I then use the export expression #stringreplace to convert the text into a number for sorting etc. for a website. See the Screen Captures.

[attachment deleted by admin]
« Last Edit: December 28, 2011, 01:31:10 am by John666 »
Windows 7 (64bit)
PVD v1.0.2.7

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Sorting using a Custom Field during export.
« Reply #13 on: December 27, 2011, 11:37:03 pm »
Quote
You must remember to include the record ID as one of the import/export fields.

...Or anything that will uniquely match records on import, if there is no ID. Using [Title] and [Year] usually works fine for movies.