"Get Value Labels" syntax helpHello,
I am developing a script that will loop through the columns in my data tables, and will apply a supercategory based on a certain set of value labels. (Value Labels({0 = "Poor", 25 = "Fair", 50 = "Good", 75 = "Very good", 100 = "Excellent"}))
I need help getting the syntax right in my non-working code below. I've attached some test data as well. Thanks in advance.
Names Default To Here( 1 );
// Specify the column name
columnName = "36/5. Considering everything about the brand you use most often, how would you rate it overall?";
// Get the column reference
col = Column(columnName);
//test to see if the value labels contain 100 = "Excellent" and if so, apply a supercategory
if (Get Value Labels(col)["100"] == "Excellent",
col << Set Property( "Supercategories", {Group( "Top 2", {75,100} ), Group( "Bottom 2", {25,0} )}));
Automation and ScriptingConsumer and Market ResearchRe: "Get Value Labels" syntax helpSomeone else might have a more elegant solution, but the example below works:
Names Default To Here( 1 );
// Specify the column name
columnName = "36/5. Considering everything about the brand you use most often, how would you rate it overall?";
// Get the column reference
col = Column(columnName);
//test to see if the value labels contain 100 = "Excellent" and if so, apply a supercategory
lst = char(col << Get Value Labels); //get col properties as string
if(contains (lst, "100 = \!"Excellent\!""), //see if 100 = "Excellent" is in the string
col << Set Property( "Supercategories", {Group( "Top 2", {75,100} ), Group( "Bottom 2", {25,0} )});
);
Re: "Get Value Labels" syntax helpYes, thank you, this should do nicely!