More > JRiver Media Center 25 for Mac
Batch replace tag conent
blgentry:
--- Quote from: HaWi on October 24, 2019, 09:57:48 am ---Brian, sorry, I'm a bit slow, I generated the Expression Column but where exactly do I type my Expression?
--- End quote ---
The dialog box for an expression column should have two little boxes: One for the title. A second (bigger box) for the expression. Type the expression into the bigger box, which is labeled "Expression".
Good luck.
Brian.
blgentry:
--- Quote from: HaWi on October 24, 2019, 09:36:40 am ---I have the Composer tag filled with LastName, FirstName (BirthYear - DeathYear) and I would like to add the LastName part of the Composer tag to the beginning of the corresponding Name tag.
So, in the Name tag going from "original_name" to "LastName: original_name"
That looks like it is going to require a more complicated expression. Is it doable?
--- End quote ---
I think it's doable. As you said, it's probably a good bit more complex. But doable. You will probably want to use regular expressions for this, but there might be other ways too.
I'm going to blindly type some code that might do something good. Or it might not. You might want to give us a few examples to work with so we can be more sure of the source data.
To get the LastName part extracted from composer, something like this should work:
--- Code: ---regex([Composer],/#^(.+),\s+#/,-1,0)[R1]
--- End code ---
Try that in an expression column and see if it extracts your LastName part or not. That probably looks extremely confusing; it's not too bad after you understand a few things. You might want to read my little tutorial on regex with JRiver MC:
https://yabb.jriver.com/interact/index.php?topic=97996.0
Once we get the LastName part, the rest should be quite easy.
Brian.
HaWi:
--- Quote from: blgentry on October 24, 2019, 12:10:11 pm ---The dialog box for an expression column should have two little boxes: One for the title. A second (bigger box) for the expression. Type the expression into the bigger box, which is labeled "Expression".
Good luck.
Brian.
--- End quote ---
Thank you Brian! Got it. It’s really useful. I love it. It’s saving me so much time.
Best wishes,
Hans
HaWi:
--- Quote from: blgentry on October 24, 2019, 12:17:00 pm ---I think it's doable. As you said, it's probably a good bit more complex. But doable. You will probably want to use regular expressions for this, but there might be other ways too.
I'm going to blindly type some code that might do something good. Or it might not. You might want to give us a few examples to work with so we can be more sure of the source data.
To get the LastName part extracted from composer, something like this should work:
--- Code: ---regex([Composer],/#^(.+),\s+#/,-1,0)[R1]
--- End code ---
Try that in an expression column and see if it extracts your LastName part or not. That probably looks extremely confusing; it's not too bad after you understand a few things. You might want to read my little tutorial on regex with JRiver MC:
https://yabb.jriver.com/interact/index.php?topic=97996.0
Once we get the LastName part, the rest should be quite easy.
Brian.
--- End quote ---
Thank you Brian! I'll give this a go. I have so far managed to add a LastName by using this expression
=Replace([Name],Field(Name, 0),LastName: Field(Name,0))
which is great for albums with mainly one Composer so I extract it "manually". I do have a few compilations with lots o different composers and for those I'd like do extract the LastName from the Composer tag and add it to the beginning of the Name tag with an expression. For example:
Mass In B Minor, BWV 232 - Kyrie: Kyrie Eleison is in the Name field
Bach, Johann Sebastian (1685-1750) is in the Composer filed
and 'd like to extract the Bach from the Composer field and add it to the Name field to result in
Bach: Mass In B Minor, BWV 232 - Kyrie: Kyrie Eleison
So if I can combine your expression to extract the LastName and combine it with my expression that should yield the desired result. I'll try tomorrow.
My sincere gratitude for your help! You guys are great.
Cheers,
Hans
blgentry:
--- Quote from: HaWi on October 24, 2019, 08:15:19 pm ---I have so far managed to add a LastName by using this expression
=Replace([Name],Field(Name, 0),LastName: Field(Name,0))
--- End quote ---
That looks like it will put the text "LastName" into your field. That's not what I was trying to suggest.
My expression looks for something like:
Beethoven, stustuf stuff stuff stuff
IT's just looking for a word, then a comma, and then a space. All at the beginning of a field. So it will match on any word that's at the beginning, as long as it has a comma and a space after it. That way it can match the last name of any composer as long as it's the first word in the field.
Hopefully you have not altered your fields yet. If you have, you can roll back to an older database backup. Or we can figure out how to remove the unneeded text.
Brian.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version