Welcome Guest

Pages: 1
Copying Fields
PhukkinPostFebruary 6, 2015, 01:13
Newbie
Posts: 17
Registered:
March 28, 2014, 05:21
Normal topicCopying Fields

Hey 2MR2.

Having a little issue here, how do I got about copying one field to the other on the condition that the source field exists? I know there is an option to do this the other way around (only copy if destination is empty). I tried the following action

Test if the Grouping Field exists
if true
copy the grouping field to genre field
end if

However if the source field is empty and the destination is not, it erases what is already in the destination for blank space. I only want it to copy from the grouping field if it actually contains data. Sorry this is probably very simple but I can't seem to figure it out 🙁

Thanks in advance.

2MR2PostFebruary 6, 2015, 06:25
Avatar photo
Administrator
Posts: 2085
Registered:
August 23, 2012, 19:27
Normal topicRe: Copying Fields

Your logic seems faultless, so I'm assuming that you're getting dinged by the execution mode. By default the action run from the UI starts in stepwise mode. The 'Exists Test' function returns true if at least one field matches the condition. If you have 10 files and one of them has a Grouping field, the action test state will be set to true.

If you use a Compare Text Test, the condition is only true if 'for all files'. Simply compare against an empty string. This is safer but still will not do exactly what you want because it will only copy if all the files have a Grouping field. You want to treat each file individually.

You can put a Forced Grouped Execution at the start of the action (which may or may not be appropriate for whatever else you're doing).

...... or you can call another action which executes groupwise.

eg.
main action statements
....
Run inline action 'Grouped Stuff' grouped
....
Start Grouped Stuff
Test if the Grouping field exists
if true
Copy the Grouping field to the Genre field
endif

In the above example everything in the 'Grouped Stuff' action is executed as a group for each file, before proceeding to the next file.

There's a help topic called 'How Actions Execute' (available off the main help page) which describes stepwise/groupwise execution mode.... hopefully a little clearer than I've just done it 🙂

Regardless of the solution, what you are trying to do is probably a fairly common scenario. I will look into adding another option to the Copy statement so that you can require the source to be 'non empty'.

PhukkinPostFebruary 9, 2015, 23:21
Newbie
Posts: 17
Registered:
March 28, 2014, 05:21
Normal topicRe: Copying Fields

Thanks mate I got it working perfectly 🙂 I have another question I was hoping you could help with.. Is there any way to set a test so that any Title field which begins with a numerical number followed by a - will return true? for example I want to remove track numbers from the title field on tracks, so rather than physically create an action to find and remove 01, 02, 03, etc, is there a regular expression or something I can use?

Thanks

2MR2PostFebruary 10, 2015, 00:06
Avatar photo
Administrator
Posts: 2085
Registered:
August 23, 2012, 19:27
Normal topicRe: Copying Fields

Here's two actions using regular expressions:

This one simply removes the leading track number and - (if any)
---------
Force Grouped Execution
Trim the Title field (SP) [Leading] [Trailing]
Find all matches for regular expression "(^[0-9]+ *- *)(.*)" in field Title, replace with "$2" in field Title, set state
---------

This one will also copy the number to the track field (if non zero)
--------
Force Grouped Execution
Trim the Title field (SP) [Leading] [Trailing]
Find all matches for regular expression "(^[0-9]+ *- *)(.*)" in field Title, replace with "$1\n$2" in field Variable 1, set state
if true
Split Field Title at delimiter "\n" save right portion to Variable 1
Exchange field Title with field Variable 1
Test if the numeric value of the Variable 1 field == 0 (Set result)
if false
Copy the Variable 1 field to the Track field
endif
endif

Sorry for the 'text' but I'm testing v3.4 and I'd have to re-install the released version to get you a copy you could import. 🙂

Pages: 1
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.009 seconds.