Custom Date Column

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Cenatra1442
Posts: 5
Joined: 30 Mar 2016 06:15

Custom Date Column

Post by Cenatra1442 »

I would be most appreciative if someone could tell me how to create a Custom Column named "Date" where I could manually input the date. This date would be used to associate a file with a real world action (e.g. a mailing date, signing date, received date, etc.). Just to clarify, I am not looking to display file metadata (e.g. modified date). Any thoughts on how to accomplish this would greatly increase my love for XYplorer! I am barely new to XYplorer so please explain like I am four. Thanks in advance for any ideas out there.

highend
Posts: 14996
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Custom Date Column

Post by highend »

Welcome to the club.

Directly editing such a custom column isn't possible...

What you need: The pro version of XY (because of scripting)

What to do:
01. Add a custom column
- Right click in the column header, "Add column"
- Right click the newly added column header (current name: "(Undefined)"), "Select Custom Column..."
- Choose an entry of the list (one of the "(Undefined)" entries), click "OK"
- Right click the newly added column header (current name is still: "(Undefined)"), "Configure Custom Column <xx>..."
Caption: e.g.: "Assoc. Date"
Type: Script
Trigger: Browse or List (depending on speed)
Rest of the fields: Leave them at their defaults

The script field:

Code: Select all

return tagitems("ex5", , <cc_item>);
Close it with clicking on "OK"

Menu - View - Folder View Settings - ...
Either save it or define it as default (whether you need it only for a single folder or for all folders)

===========================
Add a custom toolbar button

And use this script in it:

Code: Select all

    $tag = input("Enter date...", , "<date>");
    tag $tag, <curitem>, 7;
    #195;
It will ask for a string (default = current date), tags the current! selected item with that string and saves the tag database afterwards

Menu - View - Refresh List

And it should now show you the tagged date in the custom column...
One of my scripts helped you out? Please donate via Paypal

Cenatra1442
Posts: 5
Joined: 30 Mar 2016 06:15

Re: Custom Date Column

Post by Cenatra1442 »

Wow, thanks, it worked like a charm! What a great help! If I create an additional custom column, perhaps "Date2," does that change any of the above coding? Also, how can I incorporate a custom date format or even a datepicker?

highend
Posts: 14996
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Custom Date Column

Post by highend »

If I create an additional custom column, perhaps "Date2," does that change any of the above coding?
Both scripts target ex5 (extra column 5 in the tag database). If you want to use a different one / another one, modify these lines appropriately:

return tagitems("ex5", , <cc_item>);
tag $tag, <curitem>, 7;
Also, how can I incorporate a custom date format or even a datepicker?
Define the custom format. How does it look like exactly?
The script command datepicker() can be used (but it has only a date, not hours, minutes or seconds)...
One of my scripts helped you out? Please donate via Paypal

Cenatra1442
Posts: 5
Joined: 30 Mar 2016 06:15

Re: Custom Date Column

Post by Cenatra1442 »

It would look like 2016/03/30 without a time.

highend
Posts: 14996
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Custom Date Column

Post by highend »

Execute this from the address bar:

Code: Select all

::text datepicker(, "yyyy/mm/dd");
Does it output the correct format on your system?

If yes you can modify the script from:

Code: Select all

    $tag = input("Enter date...", , "<date>");
    tag $tag, <curitem>, 7;
    #195;
to:

Code: Select all

    $tag = datepicker(, "yyyy/mm/dd");
    tag $tag, <curitem>, 7;
    #195;
One of my scripts helped you out? Please donate via Paypal

Post Reply