I would like to know, how to in one easy step change a number to a higher / lower. Can it be done with an action?
Example:
BEFORE
Song A has TRACK tag 3
Song B has TRACK tag 25
Song C has TRACK tag 100
Song D has TRACK tag 2-3
Song E has TRACK tag 9-20
Song F has TRACK tag 50-100
AFTER [GOING UP]
Song A has TRACK tag 4
Song B has TRACK tag 26
Song C has TRACK tag 101
Song D has TRACK tag 3-4
Song E has TRACK tag 10-21
Song F has TRACK tag 51-101
AFTER [GOING DOWN]
Song A has TRACK tag 2
Song B has TRACK tag 24
Song C has TRACK tag 99
Song D has TRACK tag 1-2
Song E has TRACK tag 8-19
Song F has TRACK tag 49-99
[As I understand, the Autonumbering Wizard cannot deal with this]
Format value "TRACK": %TRACK%-
Guss values "%TRACK%": %TRACK_TEMP_1%-%TRACK_TEMP_2%
Format value "TRACK_TEMP-1": $add(%TRACK_TEMP_1%,1)
Format value "TRACK_TEMP-2": $add(%TRACK_TEMP_2%,1)
Format value "TRACK": %TRACK_TEMP_1% -%TRACK_TEMP_2%
Replace "TRACK": "-1" -> "" (only as a whole word)
Replace "TRACK": " " -> ""
Format value "TRACK_TEMP_1": $char(0)
Format value "TRACK_TEMP_2": $char(0)
Format value "TRACK": %TRACK%-
Guss values "%TRACK%": %TRACK_TEMP_1%-%TRACK_TEMP_2%
Format value "TRACK_TEMP-1": $sub(%TRACK_TEMP_1%,1)
Format value "TRACK_TEMP-2": $sub(%TRACK_TEMP_2%,1)
Format value "TRACK": %TRACK_TEMP_1% -%TRACK_TEMP_2%
Replace "TRACK": "--1" -> "" (only as a whole word)
Replace "TRACK": " " -> ""
Format value "TRACK_TEMP_1": $char(0)
Format value "TRACK_TEMP_2": $char(0)
And so it works both for single numbers and for ranged ones [those written with a >>-<< between them]
But there is one thing this action group of mine does not cover: sometimes I use >>~~<< and >>.<< in TRACK field for some specific purpose. Although this code is not to be used files with such special values, it should have a safety lines build in it [in case I accidentally use run it on such special files]
So what I lack now is a way to tell it [at the very beginning] to copy "~~" or "." [if they is such value] to third temporary field; so that it can be copied back to the TRACK field [if such value exist in this third temporary field]
For my system / nomenclature this now sums up to a new version like this [for going up]
Format value "TEMPORARY": $char(0)
Format value "TEMPORARY": $ifgreater($strchr(%TRACK%,'.'),0,%TRACK%,%TEMPORARY%)
Format value "TEMPORARY": $ifgreater($strchr(%TRACK%,'~~'),0,%TRACK%,%TEMPORARY%)
Format value "TEMPORARY": $ifgreater($strchr(%TRACK%,'X'),0,%TRACK%,%TEMPORARY%)
Format value "TEMPORARY": $ifgreater($strchr(%TRACK%,'X-Y'),0,%TRACK%,%TEMPORARY%)
Format value "TRACK": %TRACK%-
Guss values "%TRACK%": %TRACK_TEMP_1%-%TRACK_TEMP_2%
Format value "TRACK_TEMP-1": $add(%TRACK_TEMP_1%,1)
Format value "TRACK_TEMP-2": $add(%TRACK_TEMP_2%,1)
Format value "TRACK": %TRACK_TEMP_1% -%TRACK_TEMP_2%
Replace "TRACK": "-1" -> "" (only as a whole word)
Replace "TRACK": " " -> ""
Format value "TRACK_TEMP_1": $char(0)
Format value "TRACK_TEMP_2": $char(0) Replace "TRACK": $if2(%TEMPORARY%,%TRACK%)
Format value "TEMPORARY": $char(0)
Eventually: could the line for one of each of the four of unusual cases [>>.<<, >>~~<< >>X<<, >>X-Y<<] be replaced by one common, that would say something like: if it is no a digit, then copy it to the TEMPORARY?
I fear that in future I may in my system change for example "X-Y" to something else and simply forget to adjust this particular code on behalf of that change. And if the code would not have a list but overall instruction then this error would not show up then
Just a quick idea ...
Remove all digits from the tagfield TRACK ...
$regexp(%TRACK%,'\d',)
... if the remaining tagfield is (not) empty, ... then do this, else do that.
$if($eql($regexp(%TRACK%,'\d',),),'good','bad')
... or ...
$ifgreater($len($regexp(%TRACK%,'\d',)),0,'bad','good')
... or if the minus hyphen character is allowed ...
$if($eql($regexp(%TRACK%,'\d|-',),),'good','bad')
... or ...
$ifgreater($len($regexp(%TRACK%,'\d|-',)),0,'bad','good')