2 Replies Latest reply on Feb 15, 2012 9:38 AM by RobertA

    HELP ON VALUELIST SCRIPT!

    RobertA

      Title

      HELP ON VALUELIST SCRIPT!

      Post

      Hey Guys!

      I have another question for the forum!

      I am atempting to ease the identification process within my database to "redflag" certain chemicals by name that are on a list certified for trash disposal.  I curently have all of the names that are allowed in the trash as a value list called "DRAIN/TOSS".  what i am atempting to acheive is, everytime a user enters a chemical that is on this list, it turns the chemical name in that specific field blue. 

      here is what i have thus far...

      If [Waste tags::Chem1Name = ValueLISTItems (Get ( FileName ) ; "DRAIN/TOSS")]

          Set Field [Waste tags::Chem1Name; TextColor ( Waste tags::CHem1Name ; RGB (0 ; 0 ; 255 ) )]

      end if

      thanks for the help guys!

        • 1. Re: HELP ON VALUELIST SCRIPT!
          philmodjunk

          valueListItems returns a list of all values in the value list. Since you have multiple items on the list, comparing a single name to the entire list fails even if it is somewhere in that list due to the other values in the list.

          Say you have this list in "drain/toss": Sodium Chloride, Sucrose

          IF you have "Sucrose" in Chem1Name, your expression is evaluating as:

          If ["Sucrose" = "Sodium Chloride <ReturnCharacter>Sucrose"]

          and this is false.

          Use this expression:

          Valuecount ( FilterValues ( ValueLISTItems (Get ( FileName ) ; "DRAIN/TOSS") ; Waste tags::Chem1Name ) )

          If any of these functions are unfamiliar, you can look them up in help to see how and why they work here.

          And in most cases, I'd use this in a conditional format expression instead of in a script, but you may have good reason for changing the actual data by adding the blue formatting data to it.

          • 2. Re: HELP ON VALUELIST SCRIPT!
            RobertA

            Hey Phil,

            i gota say, you are awsome!

             

            thank you so much for all your help and advice!

             

            Robert