# Help Left Function

**URL:** <https://community.mp3tag.de/t/help-left-function/46090>\
**Category:** Support\
**Created:** [August 5, 2019, 2:00pm UTC](https://community.mp3tag.de/t/help-left-function/46090 "2019-08-05T14:00:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![fracta](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/d07c76/32.png) [@fracta](https://community.mp3tag.de/u/fracta)\
**Post date:** [August 5, 2019, 2:00pm UTC](https://community.mp3tag.de/t/help-left-function/46090/1 "2019-08-05T14:00:40Z")

</div>

Hello,

I am writing several info into the Comment field.  
Basically I have the key, then rating, the other info..  
I would like to extract the key and the rating from the comment field to 2 additional fields called: KEY2 and Rating  
I tried to use the left() function..but it does not work..  
I did some search on the forum..and did not found what to fill in for the value , the field...

Any one could help me ?

thanks

fracta

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [August 5, 2019, 4:58pm UTC](https://community.mp3tag.de/t/help-left-function/46090/2 "2019-08-05T16:58:08Z")

</div>

See e.g. the help on string functions:

> **[Scripting Functions – Mp3tag Documentation](https://docs.mp3tag.de/scripting/#string-functions)**
>
> Documentation on Mp3tag's scripting functions. Mp3tag is the universal Tag Editor.

**$left(x,n)** returns the leftmost n characters of string x.

So, to get the first 7 characters from the left of a string (e.g. "Rolling Stones") use  
$left("Rolling Stones",7)  
and get "Rolling".  
Instead of a string constant you can also use string variables like %artist%:  
$left(%artist%,7)  
or in your case  
$left(%comment%,5).  
But if you show us the real, typical data, it could be that $left() is not the best function for your problem.

---

<div class="post-metadata">

**Author:** ![fracta](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/d07c76/32.png) [@fracta](https://community.mp3tag.de/u/fracta)\
**Post date:** [August 5, 2019, 5:13pm UTC](https://community.mp3tag.de/t/help-left-function/46090/3 "2019-08-05T17:13:30Z")

</div>

great thanks a lot for your quick answer.

my comment field is like this

5A - 5 - Top - Tubes - Intro  
or  
12B - 3

I would like to extract the comment field into 3 or 4 fields

Field 1 would contain the key 2/3 digits  
Field 2 would contain the iTunes rating  
Field 3 would contain the rest

in the comment field, All data are separated by a "-"

thanks a lot for your help

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [August 5, 2019, 5:20pm UTC](https://community.mp3tag.de/t/help-left-function/46090/4 "2019-08-05T17:20:53Z")

</div>

> [@fracta](#):
>
> 5A - 5 - Top - Tubes - Intro

You could try an action of the type "Guess value"  
Source: %comment%  
Pattern: %initialkey% -%popularimeter% - %field3%

and for

> [@fracta](#):
>
> 12B - 3

use also "Guess value"  
Source: %comment%  
Pattern: %initialkey% -%popularimeter%

---

<div class="post-metadata">

**Author:** ![fracta](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/d07c76/32.png) [@fracta](https://community.mp3tag.de/u/fracta)\
**Post date:** [August 5, 2019, 5:24pm UTC](https://community.mp3tag.de/t/help-left-function/46090/5 "2019-08-05T17:24:39Z")

</div>

ok I did not know this function...

my concern is that I should use the same formula...so will use the first 1 and my field 3 will be empty some times...

will give a try a let you know

thanks again

---

<div class="post-metadata">

**Author:** ![fracta](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/d07c76/32.png) [@fracta](https://community.mp3tag.de/u/fracta)\
**Post date:** [August 5, 2019, 5:39pm UTC](https://community.mp3tag.de/t/help-left-function/46090/6 "2019-08-05T17:39:44Z")

</div>

i give a try...it works for the classic field "mood"..but not for the new field I have added...  
i have created a field Key2. and Rate...to collect the key and the rating..

here the action I did: %key2% - %rate% - %mood%

result: Im able to extract the mood value: top - end  
but not the key and rate

thanks for your help

---

<div class="post-metadata">

**Author:** ![fracta](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/d07c76/32.png) [@fracta](https://community.mp3tag.de/u/fracta)\
**Post date:** [August 5, 2019, 5:46pm UTC](https://community.mp3tag.de/t/help-left-function/46090/7 "2019-08-05T17:46:53Z")

</div>

ok i made some progress... now I have the output..but only if the field3 is in comment

If comment = 5A - 5 - Top  
this is working properly %key2% - %rate% - %mood%

but if comment = 5A - 4  
I get nothing in output....

any idea ?

thanks

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [August 6, 2019, 7:52am UTC](https://community.mp3tag.de/t/help-left-function/46090/8 "2019-08-06T07:52:19Z")

</div>

> [@fracta](#):
>
> but if comment = 5A - 4  
> I get nothing in output....

Yes, that is a different pattern - there is nothing to fill %mood%. So you may only use

> [@fracta](#):
>
> %key2% - %rate%

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [September 5, 2019, 8:05am UTC](https://community.mp3tag.de/t/help-left-function/46090/9 "2019-09-05T08:05:04Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
