Problem with multi value fields

Hi
I have flac files and mp3tag has been working well. I have one use case where I have some tracks that have 00\\01 for the TRACKNUMBER field. This is a multi value field but in all other cases I have removed the Disctoal element. In these use cases, the 00 is the DISCNUMBER and the 01 is the TRACKNUMBER. I only want the latter. I have tried the tag field format using the regex expression $regex(%trackname%,^.*\\(.*)$,$1) but it consistently returns the first number (00) NOT the second number (01). I have tried various other cpommands also including meta() and all of them refuse to show me the second number which is the one I want. I have checked using a filter if the field is multi value and it is, not sure why either?

You could simplify this operation. I see that you are using custom fields. I suggest numbering via Mp3tag's standard field TRACK initially. Use the Auto-numbering Wizard to fill that field, one CD at a time.

Just make sure that the sort order of your TRACKNUMBER column matches the order that you want before running the Wizard on each group of files.

After that you could simply copy over the new track numbers into your TRACKNUMBER fields by using a Format Value action (see screenshot below)

FormatValue TrackNum

Try
$meta(track,1) to address the 2nd value.
$meta(track,0) addresses the 1st..

Thank you. Will try that. The fields are actually mapped and populated generally by power amp whilst ripping. That works fine. These odd cases are using a different music source which Pilates things differently

Tried that. Off I use 00\\01 rather than the %tracknumber% it works. Doesn’t with the variable for some reason

Mysterious.
Could you show us a screenshot of the the extended tags dialogue?
And perhaps of the Options>Mapping?

Showing an example of the data in the main screen
Screen Shot 2024-09-29 at 14.47.57 pm

The display list is defined as follows which works ok
Screen Shot 2024-09-29 at 14.52.11 pm

Showing picture of track. Extended tags shows that it is correctly showing two Tracknumber fields

BUT $regexp(%tracknumber%,^.*\\(.*)$,$1) still comes up with 01 in this case NOT the second group which is what I expect. And meta(x,y) seems to always pull out the first group too . . .

The mappings are made in dbpoweramp so that it writes into Tracknumber and Discnumber, so no extra mappings in mp3tag . . .

AFAIK you can not expect that the multi value field TRACKNUMBER shows 01\\02 by default.
This is the assumption for your regular expression.

If you want to extract 02 in your example with your regular expression, you could try it with:
$regexp($meta_sep(tracknumber,\\\\),^.*\\(.*)$,$1)
or as @ohrenkino wrote:
$meta(tracknumber,1)

... apparently, you created a field called %TRACKNUMBER and not TRACKNUMBER ... but that is a different problem.

If you have multi-value fields and you want to treat them as 1 field, you first have to merge them either with an action or use $metasep() befory you can apply other functions on the whole string.

grafik
This is what the mapping looks like in my configuration.

Yes, that returns the original contents of the first instance of TRACKNUMBER as the regular expression doesn't find a match ...
Please try $meta(tracknumber,0) and $meta(tracknumber,1) in the preview of Convert>Tag-Tag - that is a good test bench to see the results of scripting functions.
Just a test on an MP3 file with 2 track numbers:
grafik
and the preview in Convert>Tag-Tag:
grafik
... as expected.

Mmmmm. I did try both of those and it still returned first pair. If I used “01\\02” it worked. I also tried the metasep function and that didn’t help either. Will fiddle again. Thanks for the suggestions

Nope def doesn't work. The two TRACKNUMBER fields exist. If I use $meta(%tracknumber%,0) I get NULL, same if I go for the second entry by using 1. Weird. As I said the regex or expression works if I put text instead of the variable name but something is coming through wrong. I am using the Mac version if that has any significance . . .

Now screenshots of corresponding tests on your side would be nice

it works in the convert tag-tag test you suggested but returns zero in the action using the same function and has deleted both TRACKNUMBER instances

Could you show a screenshot of the function that you used, please?

The two functions I used are shown below:

Screen Shot 2024-09-29 at 19.30.45 pm

Screen Shot 2024-09-29 at 19.31.01 pm

To make $regexp() evaluate all the TRACKNUMBER instances, use

$regexp($metasep(tracknumber,\\),^.*\\(.*)$,$1)
... but this should yield the same result as $meta(tracknumber,1)

nope. should work but doesn't. Same as the meta function. Just deletes them. Very odd as thet work in the concert side

Try it in Convert>Tag-Tag and then copy the working string to an action of the type "Format tag field".

ok working now. i was picking up the tracknumber kin the expression from the pick list which effectively added the % around it. If you remove them it all works fine. Thank you for your persistence!!

That is what I said:

Reset the field list so that this irregular field gets removed to avoid further problems