Formulas

Discussion related to "Everything" 1.5 Alpha.
Post Reply
dedupeit
Posts: 29
Joined: Thu Jul 28, 2022 9:52 pm

Formulas

Post by dedupeit »

Is there a way to set a column to a formula as part of options, so that I don't have to set it in the search bar each time?
Last edited by NotNull on Tue Dec 10, 2024 11:34 pm, edited 1 time in total.
Reason: Split from Formulas documentation
dedupeit
Posts: 29
Joined: Thu Jul 28, 2022 9:52 pm

Re: Formulas

Post by dedupeit »

Another formula question

I'm working with photos/videos. Photos have a date_taken property while videos have a media_created property. This formula puts them into a single column:

add-column:a a:=concat($date-taken:,$media-created:) a-format:datetime

For files that don't have either property set, I'd like to use the modified time. I don't know how to make that happen. I tried using ifdef but wasn't able to get it to work.

By the way, should we just have one thread for all formula questions/help?
void
Developer
Posts: 17149
Joined: Fri Oct 16, 2009 11:31 pm

Re: Formulas

Post by void »

Is there a way to set a column to a formula as part of options, so that I don't have to set it in the search bar each time?
Currently, no.
Functions and macros might be added in a future release.
For now, please use bookmarks.


I'm working with photos/videos. Photos have a date_taken property while videos have a media_created property. This formula puts them into a single column:

add-column:a a:=concat($date-taken:,$media-created:) a-format:datetime

For files that don't have either property set, I'd like to use the modified time. I don't know how to make that happen. I tried using ifdef but wasn't able to get it to work.
add-column:a a:=$date-taken:?$date-taken::($media-created:?$media-created::$dm:) a-format:datetime



By the way, should we just have one thread for all formula questions/help?
Anywhere in the Everything 1.5 alpha forum is fine.
dedupeit
Posts: 29
Joined: Thu Jul 28, 2022 9:52 pm

Re: Formulas

Post by dedupeit »

void wrote: Fri Dec 20, 2024 10:02 pm
Currently, no.
Functions and macros might be added in a future release.
For now, please use bookmarks.
Gotcha. I think of the search as separate from formulas and presentation. It would be nice to have the formulas/presentation remain while searching for different thing. Thanks for considering this for the future!

add-column:a a:=$date-taken:?$date-taken::($media-created:?$media-created::$dm:) a-format:datetime
Amazing!
hamid56
Posts: 29
Joined: Sun Jul 20, 2014 9:38 am

Re: Formulas

Post by hamid56 »

dear David
please explain function of :: and at which situation is used?
NotNull
Posts: 5517
Joined: Wed May 24, 2017 9:22 pm

Re: Formulas

Post by NotNull »

The :: is a coincidence.

This function makes use of a ternary operator
This ternary operator is written as "something?"this":"that" an it translates to : If "something" THEN "this" ELSE "that".

So the following:
$date-taken:?$date-taken::($media-created:?$media-created::$dm:)

can be ttranslated to:

Code: Select all

IF date-taken exists
THEN 
  value is date-taken
ELSE 
  IF media-created exists
  THEN
    value is media-created
  ELSE 
    value is date-modified
hamid56
Posts: 29
Joined: Sun Jul 20, 2014 9:38 am

Re: Formulas

Post by hamid56 »

So thanks notnull
dedupeit
Posts: 29
Joined: Thu Jul 28, 2022 9:52 pm

Re: Formulas

Post by dedupeit »

Quick follow up question. I can filter datetaken, mediacreated or datemodified individually using dd/MM/yyyy syntax. But with columna as defined above, I'm no longer able to use that syntax. I think it forces me to use the epoch timestamp. Is there a trick to getting dd/MM/yyyy to work as a filter there?

On a completely separate topic, I've been getting 403 errors intermittently while trying to browse different threads in the forum. Even with different browsers and/or incognito mode.
void
Developer
Posts: 17149
Joined: Fri Oct 16, 2009 11:31 pm

Re: Formulas

Post by void »

Custom columns are currently treated as text.

Please use formulas to filter by dates.

For example:

DATEVALUE($a:)>=DATE(2023,1,1) DATEVALUE($a:)<=DATE(2023,12,31)




Adding type support to formulas is on my TODO list.
For example: date-taken:?$date-taken::($media-created:?$media-created::$dm:) returns a date value.



There was a few blocks for certain user agents under certain conditions.
There are a lot of bad actors hitting this site.
I have temporarily removed some of these blocks.
Please let me know if you see any more 403 errors.
dedupeit
Posts: 29
Joined: Thu Jul 28, 2022 9:52 pm

Re: Formulas

Post by dedupeit »

Awesome, appreciate the tip and considering changing the type in the future!

Still getting 403s on my Mac. PC and iPhone are ok.
Post Reply