Database Expressions: Difference between revisions

From wiki.jriver.com
Jump to navigation Jump to search
No edit summary
No edit summary
 
(12 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Deprecated
|altpage=[[Expression Language]]}}

==Description==
==Description==
While it is possible to use expressions in the search bar, the need does not arise very often so perhaps we'll go there later.
While it is possible to use expressions in the search bar, the need does not arise very often so perhaps we'll go there later.
Expressions can be used in lots of places around MC, for different reasons, with the most common reason being aesthetic, so lets start there.
[http://wiki.jriver.com/index.php?title=Media_Center_expression_language Expression functions] can be used in lots of places around MC, for different reasons, with the most common reason being aesthetic, so lets start there.


Say you want a pane to show you the [number plays] field. Add one to a view scheme and you see the values for [number plays], but, all those files that have never been played are listed in the pane under "Unassigned". I don't like unassigned, and now that we have expressions, we can get rid by using one instead of the standard library field. Simply get rid of the standard [number plays] pane, and replace it with an expression that says, show me [number plays], unless it's empty, in which case, show me "Not Played Yet"
Say you want a pane to show you the [number plays] field. Add one to a view scheme and you see the values for [number plays], but, all those files that have never been played are listed in the pane under "Unassigned". I don't like unassigned, and now that we have expressions, we can get rid by using one instead of the standard library field. Simply get rid of the standard [number plays] pane, and replace it with an expression that says, show me [number plays], unless it's empty, in which case, show me "Not Played Yet"
Line 19: Line 22:
In this [http://yabb.jriver.com/interact/index.php?topic=36437.msg248529#msg248529 post], I describe how creating two new expression based library fields from the [date (filename friendly)] field and then sorting by them, allows you to list photos "Newest first, but sorted oldest first within days" so you see photos taken today at the top of the list, sorted into the order they were actually taken.
In this [http://yabb.jriver.com/interact/index.php?topic=36437.msg248529#msg248529 post], I describe how creating two new expression based library fields from the [date (filename friendly)] field and then sorting by them, allows you to list photos "Newest first, but sorted oldest first within days" so you see photos taken today at the top of the list, sorted into the order they were actually taken.


When using the "rename from properties" tool, I use strict rules, dictated by media type. I've created rather long expressions for both the file name, and the directory fields which allow me to select a bunch of tagged files, right click, rename from properties and immediately click the OK button. I don't need to worry myself about things like [media type], if the tags are correct, MC will place each file in the correct location. '''The only short-coming here is that we cannot use expressions in the 'base path' field, so everything has to go on the same drive. I pray we get this ability before the need arises for me to start using different drives for different media.'''
When using the "rename from properties" tool, I use strict rules, dictated by media type. I've created rather long expressions for both the file name, and the directory fields which allow me to select a bunch of tagged files, right click, rename from properties and immediately click the OK button. I don't need to worry myself about things like [media type], if the tags are correct, MC will place each file in the correct location. One of the many improvements introduced in v12 is the ability to use expressions in the 'base path' field too. This means that we can now use an expression here to do things such as place different file types on different drives.


When playing picture slideshows, MC shows a caption beneath each slide. This is nice, but a pain if pictures don't all contain the tags specified in the caption string. Again, this can be avoided by using expressions to display a different tag if another is not available.
When playing picture slideshows, MC shows a caption beneath each slide. This is nice, but a pain if pictures don't all contain the tags specified in the caption string. Again, this can be avoided by using expressions to display a different tag if another is not available.
Line 27: Line 30:
In summary, expressions are a lot like smartlists in that they are more personal than portable. You would use them to bend MC into a shape that's right for you, for reasons best known to you, therefore, your expressions would likely not make a lot of sense, nor be a lot of use to someone else, hence the reason, IMVHO, that the expression and smartlist sharing threads are not as popular as everyone wishes they were.
In summary, expressions are a lot like smartlists in that they are more personal than portable. You would use them to bend MC into a shape that's right for you, for reasons best known to you, therefore, your expressions would likely not make a lot of sense, nor be a lot of use to someone else, hence the reason, IMVHO, that the expression and smartlist sharing threads are not as popular as everyone wishes they were.


When you want MC to do something, best policy so far has been to ask how. If expressions are the answer, take that opportunity to ask why, and so learn a little from the questions. Once you get started, it doesn't take long before you instinctively know what you need, and how to get it.
When you want MC to do something, best policy so far has been to ask how. If expressions are the answer, take that opportunity to ask why, and so learn a little from the questions. Once you get started, it doesn't take long before you instinctively know what you need, and how to get it. [http://wiki.jriver.com/index.php/Database_Expressions_AND_OR_And_XOR continued (AND, OR, and XOR)]


[http://yabb.jriver.com/interact/index.php?topic=38566.msg262142#msg262142 Thanks marko].
[http://yabb.jriver.com/interact/index.php?topic=38566.msg262142#msg262142 Thanks marko].
Line 41: Line 44:
==Images==
==Images==
*[[Display Captions During Slideshow]]
*[[Display Captions During Slideshow]]
*[[Find solo photos of someone]]


==Video==
==Video==

Latest revision as of 05:32, 30 October 2015

Deprecated: This content has been deprecated as of current versions and may no longer be valid. Please refer to Expression Language for additional details.

Description

While it is possible to use expressions in the search bar, the need does not arise very often so perhaps we'll go there later. Expression functions can be used in lots of places around MC, for different reasons, with the most common reason being aesthetic, so lets start there.

Say you want a pane to show you the [number plays] field. Add one to a view scheme and you see the values for [number plays], but, all those files that have never been played are listed in the pane under "Unassigned". I don't like unassigned, and now that we have expressions, we can get rid by using one instead of the standard library field. Simply get rid of the standard [number plays] pane, and replace it with an expression that says, show me [number plays], unless it's empty, in which case, show me "Not Played Yet" if(isempty([number plays],Not Played Yet,[number plays])

I use the formatdate expression quite a lot to get dates shown the way I want them. [date imported] without the time, for example.

formatdate([date imported,0],yyyy - MM -dd)

Where these things really come into their own, is with your picture library. The difference is that with audio, everything is pretty linear, and using a details view, most of the info we want is there to see, easy. With pictures, we really need to be in thubnail view, so detais are hidden, and space beneath the thumbnail for information is tight. Enter expressions... My image workflow dictates that if a picture does not have a subject tag, then it's not tagged, so, the following expression:

if(isempty([subject],not tagged,)

will place the not tagged text under the thumbnail if it's not tagged, and show nothing if it is tagged, freeing up space for other info I may want on display.

In this post, I describe how creating two new expression based library fields from the [date (filename friendly)] field and then sorting by them, allows you to list photos "Newest first, but sorted oldest first within days" so you see photos taken today at the top of the list, sorted into the order they were actually taken.

When using the "rename from properties" tool, I use strict rules, dictated by media type. I've created rather long expressions for both the file name, and the directory fields which allow me to select a bunch of tagged files, right click, rename from properties and immediately click the OK button. I don't need to worry myself about things like [media type], if the tags are correct, MC will place each file in the correct location. One of the many improvements introduced in v12 is the ability to use expressions in the 'base path' field too. This means that we can now use an expression here to do things such as place different file types on different drives.

When playing picture slideshows, MC shows a caption beneath each slide. This is nice, but a pain if pictures don't all contain the tags specified in the caption string. Again, this can be avoided by using expressions to display a different tag if another is not available.

If you use the playingnow plugin, you'll know that it displays tag info in a popup box. For the most part, that info is static, but, you can create expression based fields specifically for playingnow to use. In my signature image, the text in the bottom line, from the number of plays to the end is all generated by a single expression based field.

In summary, expressions are a lot like smartlists in that they are more personal than portable. You would use them to bend MC into a shape that's right for you, for reasons best known to you, therefore, your expressions would likely not make a lot of sense, nor be a lot of use to someone else, hence the reason, IMVHO, that the expression and smartlist sharing threads are not as popular as everyone wishes they were.

When you want MC to do something, best policy so far has been to ask how. If expressions are the answer, take that opportunity to ask why, and so learn a little from the questions. Once you get started, it doesn't take long before you instinctively know what you need, and how to get it. continued (AND, OR, and XOR)

Thanks marko.


Following is a collection of Database Expressions that users have contributed.

Audio

Images

Video