title
Products            Buy            Support Forum            Professional            About            Codec Central
 

DSP ID Tag Proc. - Rule Based Mapping - Empty/NULL values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RLANE
    dBpoweramp Enthusiast

    • May 2011
    • 138

    DSP ID Tag Proc. - Rule Based Mapping - Empty/NULL values

    I cannot figure out how to use a script in Rule Based Mapping that will only execute when the tag exists and a value is found.
    I want the script to read a custom tag named MasterYear and add " - " + the MasterYear value if a value is found.
    For example, if the value of MasterYear is 2007 then the script would write " - 2008".
    If there is a value in the MasterYear tag, it works fine. But, if I leave MasterYear blank, or delete it so the tag does not get created, the script still writes " - ".
    Options I have tried include

    IF [tag]MasterYear[] =
    SET Album = [album] - [tag]MasterYear[]

    and

    IFCONTAINS [tag]MasterYear[] = 20
    SET Album = [album] - [tag]MasterYear[]
    IFCONTAINS [tag]MasterYear[] = 19
    SET Album = [album] - [tag]MasterYear[]
  • mville
    dBpoweramp Guru

    • Dec 2008
    • 4021

    #2
    Re: DSP ID Tag Proc. - Rule Based Mapping - Empty/NULL values

    Try:

    IF MasterYear=[anyvalue]
    SET Album=[album] - [tag]MasterYear[]

    Comment

    • RLANE
      dBpoweramp Enthusiast

      • May 2011
      • 138

      #3
      Re: DSP ID Tag Proc. - Rule Based Mapping - Empty/NULL values

      Tried that too. Still always writes the " - ".
      I essentially cannot get any Rule Based Mapping script to ONLY write a value expression if (1) the tag exists AND (2) it is NOT blank.
      There are several scripts I am trying to do that with. This MasterYear value is just one of the many.

      Another custom tag is %SPARS%.

      I've tried:

      IF [tag]SPARS[] = [anyvalue]
      SET Album = [ablum] ([tag]SPARS[])

      And I've tried:

      IFCONTAINS [tag]SPARS[] = "ADD"
      SET Album = [ablum] ([tag]SPARS[])
      IFCONTAINS [tag]SPARS[] = "AAD"
      SET Album = [ablum] ([tag]SPARS[])
      IFCONTAINS [tag]SPARS[] = "DDD"
      SET Album = [ablum] ([tag]SPARS[])


      In both cases, when the SPARS tag does not exist or is blank I get the "()" following the Album value.

      Comment

      • mville
        dBpoweramp Guru

        • Dec 2008
        • 4021

        #4
        Re: DSP ID Tag Proc. - Rule Based Mapping - Empty/NULL values

        Originally posted by RLANE
        I essentially cannot get any Rule Based Mapping script to ONLY write a value expression if (1) the tag exists AND (2) it is NOT blank.
        OK. First, are you sure the MasterYear and Spars tags are blank, i.e. NULL or $char(0) and do not contain a space?

        I've always assumed that

        If Genre=
        Set Genre='NULL'

        If Genre=[anyvalue]
        Set Genre='Not NULL'

        but I may be wrong, or it's a bug.
        Last edited by mville; February 22, 2013, 12:59 AM.

        Comment

        • RLANE
          dBpoweramp Enthusiast

          • May 2011
          • 138

          #5
          Re: DSP ID Tag Proc. - Rule Based Mapping - Empty/NULL values

          Three tests I used:

          1. Use delete key on field in tag editor pane prior to ripping.
          2. Skip the field in tag editor pane (ie., be sure it never received any focus)
          3. Use the "X" in the tag editor pane to prevent the creation of the tag (verified after ripping no tag created)

          In all three cases, the script writes the surrounding parenthesis "()" at the end of the Album value.
          When the field exists and is populated, the script properly writes the desired string (a left parenthesis followed by the tag value followed by a right parenthesis) at the end of the Album value.

          Comment

          • RLANE
            dBpoweramp Enthusiast

            • May 2011
            • 138

            #6
            Re: DSP ID Tag Proc. - Rule Based Mapping - Empty/NULL values

            I get it now. The [tag]<>[] format only applies to the SET expression when using custom tags. In the IF expression the custom tag name only works. Is that documented somewhere - when the [tag]<>[] format is required when using a custom tag and when only the custom tag name is ufficient?

            Comment

            • RLANE
              dBpoweramp Enthusiast

              • May 2011
              • 138

              #7
              Re: DSP ID Tag Proc. - Rule Based Mapping - Empty/NULL values

              Originally posted by RLANE
              I get it now. The [tag]<>[] format only applies to the SET expression when using custom tags. In the IF expression the custom tag name only works. Is that documented somewhere - when the [tag]<>[] format is required when using a custom tag and when only the custom tag name is ufficient?
              I'm doing beter since discovering the above.
              But the original problem I wrote about still exists.
              Both of the following vehave identically.

              IF <anytagname>=
              SET ....

              IF <anytagname>=[anyvalue]
              SET ....

              Using [anyvalue] returns a TRUE where the tag does not exist, is NULL, or is empty.

              Comment

              • mville
                dBpoweramp Guru

                • Dec 2008
                • 4021

                #8
                Re: DSP ID Tag Proc. - Rule Based Mapping - Empty/NULL values

                Originally posted by RLANE
                Both of the following behave identically.

                IF <anytagname>=
                SET ....

                IF <anytagname>=[anyvalue]
                SET ....

                Using [anyvalue] returns a TRUE where the tag does not exist, is NULL, or is empty.
                Spoon, is this by design or is it a bug?

                Comment

                • Spoon
                  Administrator
                  • Apr 2002
                  • 44506

                  #9
                  Re: DSP ID Tag Proc. - Rule Based Mapping - Empty/NULL values

                  I think by design it should be [anyvalue] = true when a tag contains a value, not sure we can change what ever its behavior is now.
                  Spoon
                  www.dbpoweramp.com

                  Comment

                  • mville
                    dBpoweramp Guru

                    • Dec 2008
                    • 4021

                    #10
                    Re: DSP ID Tag Proc. - Rule Based Mapping - Empty/NULL values

                    Originally posted by Spoon
                    it should be [anyvalue] = true when a tag contains a value
                    So when does it return false?

                    Comment

                    Working...

                    ]]>