Unfortunately, it removes everything placed before the last "##"
That seems to do nothing
The sorting could be done quite easily [although in long steps]
A] Remove all the "##" [which leaves numbers in format >>00<<]
B] Replace words with numbers [in format >>00<<]
C] Leave only one instance of each number [because I need to remove the doubled and tripled ones]
D] Rearrange numbers in order [sort them out]
E] Put two pauses after each number
F] Change [specified] numbers back to words
G] Put back "##" in front of the numbers
H] Put back "##" in front of the words
I] Remove unnecessary pauses
So, I would like to ask for codes for point C, D and E
Also, I'm afraid that step D could mess things up [because it could possibly turn for example "99 01" into "0199" instead of "01 99"]
And please note, that all the time I'm using the "##" [double hashtag] as a marker and not "#" [single one]; becasue I already use a single # chacacter [in TITLE tag for different purposes]
If you are looking for a built in function: hard luck, there is none.
Also, you cannot use any nested loops to treat a string.
You could export the field to a text file,
use the command shell function "sort"
let "sort" create an output file that you then import back into the tag.
To see what "sort" can do, open a command shell window and type in: help sort
But, aside from possible re-designing the system, it would still require physically going [switching] to another window with different program and doing there some clicking? If yes then I will have to do this sorting manually
As long as I will do it on a big set of files and have all the data in the same format [with numbers], I could to this quite efficient; aside from course occasionally missing some errors, which can be possibly taken care of during the next evaluation
And the bigger the set the better [to some point I imagine...], because it will be somewhat easy to spot an error like this
##01 ##02 ##03 ##44 ##59 ##99 ##90
if it is between tens of looking the same correct ones
zerow, I do not understand what you are telling me, ...
therefore I made an example action group script ...
to demonstrate how to sort number strings in the range from '01' to '99'.
Begin Action Group Test2015#20150617.Example.Sort.01to99
Action #1 Actiontype 5: Format value Field ______: LIST_CURRENT Formatstring: '04|21|69|99|17|01|38|78'
Action #2 Actiontype 5: Format value Field ______: LIST_ORDERED Formatstring: '01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|
Action #3 Actiontype 5: Format value Field ______: LIST_RESULT Formatstring: $regexp($regexp($regexp(%LIST_ORDERED%,$regexp(%LIST_ORDERED%,'(?>('%LIST_CURRENT%'))',),),'|+','|'),'|$',)
End Action Group Test2015#20150617.Example.Sort.01to99 (3 Actions)
... which gives ...
LIST_RESULT = 01|04|17|21|38|69|78|99
I have run this action group on a field with value
And it stayed the same; nothing changed
Aside from that, my question is: is this is going to work only, if I predefine [write down to that action group] a separate entry [action] for every possible combination of errors?
For example a common mistake will be
Please try again.
At my side there is no problem to get ...
I've read the code and thought about what is suppose to happen and finally understood it [but not how it is happening]; and so I see that it works now
And now I have the right tool and the knowledge how to adapt it to my needs. I've already made some changes in it. But to make the whole operation simpler [with less steps, which will come in handy in the future in case of making any changes to the naming structure] I've tried to replace the
|sign used by you with the indicators used by me, in form of
And with such change, the code stops to work. Is there some problem with using hashtags? Or a change like that shouldn't be a problem and I just messed up something?
Also: why does the first number [in my unsorted string of numbers] can't have the indicator? I have putted it to the front of LIST_ORDERED, but it didn't help
Note: The pipe symbol or vertical bar "|" has the meaning of "alternation" resp. "or", ...
and is used within the regular expression to separate alternative values.
'01' or '02' or '03' ==> '01|02|03'
See also: http://www.regular-expressions.info/alternation.html
I don't know for sure, but you may try for your case ...
... or ...
1] Guess values %GENRE%: ##%GENRE%
2] Replace "GENRE": "##" -> |
3] Replace "GENRE": " " -> ""
4] Format value "GENRE_ORDER": '00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|2
5] Format value "GENRE": $regexp($regexp($regexp(%GENRE_ORDER%,$regexp(%GENRE_ORDER%,'(?>('%GENRE%'))',),),'\|+','|'),'\|$',)
6] Replace "GENRE": "|" -> " ##"
7] Format value "GENRE": $trim(%GENRE%)
8] Format value "GENRE": ##%GENRE%
It works if run it on a GENRE tag that has values in format
##00 ##00 ##AAAAAAA ##00 ##BBB
[two hastags + two digit number or predifined capitalized word + two pauses]
A] What is the code for making any number of spaces into only two spaces, including in the middle of a tag? Or what is the code for making 3 or more spaces into two spaces? Right now I use [before I run this action group that we are speaking of in this post] many many [just for sure] instances of
Replace "GENRE": " " -> " "
for achieving my format
B] This code has a big issue. If you run it on
##9X ##WATER ##00 ##UNDERWATER ##50 ##VILLAGE
it will give you a proper
##00 ##UNDERWATER ##VILLAGE ##WATER ##50 ##9X
But if you run it on
##9X ##WATER ##00 ##50 ##VILLAGE
you will get a reasult with a wrongly doubled value
##00 ##WATER ##VILLAGE ##WATER ##50 ##9X
just because on the list of words [within this list of those 00-99 numbers] there is "UNDERWATER" and "WATER". I could work around this problem by temporary changing words to some additional numbers / codes [like X00, X01, X03], but as the word list is a work in progress, I would rather not have to [remember to make additional changes in this GENRE rearranging action group every time I will add new words or change the old ones]
Which removed only up to 11 unnecessary spaces and also changed one into two
So what you are saying is, I have to do a workaround: change all the words [or at least cases like WATER / UNDERWATER] to unique set of characters; and run the code in version including those temporary unique changes in the order list?
Because double WATER is immanent and is not to be viewed as an error?
Well, there is a problem within the regular expression, which has not be shown, when using numerical string values in the range from '01' to '99', but might coming up for strings like '101' .
Other text strings like 'WATER' and 'WATERFALL' will show the same problem.
There is no problem for 'WATER' and 'UNDERWATER'.
The failure was in the regular expression, which has evaluated the leading string fragment but not an entire word. Following example now evaluates a word for the comparing.
LIST_IN <== '111|101|01|WATER|WATERFALL|04|VILLAGE|06|UNDERWATER|03|02|10|11'
LIST_SORT <== '01|02|03|04|05|06|07|08|09|10|11|101|111|UNDERWATER|VILLAGE|WATER|WATERFALL'
LIST_OUT <== $regexp(
LIST OUT = 01|02|03|04|06|10|11|101|111|UNDERWATER|VILLAGE|WATER|WATERFALL
Apparently because it:
1] sees the marker "##"
2] reads "99"
3] continues to read to the next marker [?]
4] compares read value with the list
5] cuts out than long [merged] characters
The hypothetical "SOMETHING-NOT-ON-THE-LIST" should not be there in the first place [and is most probably to be get rid off in this process of cleaning]. But, as proven by this example, it would be better, if the code would look for a marker and then read from its beginning to the last character adjacent to it [somewhat in "as a whole word" way]. Because it is batter to loose only "SOMETHING-NOT-ON-THE-LIST" and "##SOMETHING-NOT-ON-THE-LIST" than a "##listed_number" + "SOMETHING-NOT-ON-THE-LIST"
[And if you're wondering why there are word with numbers and not just numbers, it's because I have to be absolutely sure what words I want to code with numbers. Because one I'll start using numbers, any future change would bring a lot of potential errors coming out from the changed and re-changed codes and difficulty in re-memorizing. Right now I use only some umbers from the range of 1-10 and 50-99, and after dealing with 20% of my files I need to do cleaning / evaluation]