BookmarkSubscribe
Choose Language Hide Translation Bar
Highlighted
rshehadah
Community Trekker

A phrase in a Column to a marker

Hi,

 

I have a col with different type of annotations. I was wondering how can I create a script to change the markers for the speficic pharse.

 

For example, If i have the color red, I want the marker to be a circle, if I have the color blue I want it to be a sqaure and so on.

 

Thank you,

Rami

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: A phrase in a Column to a marker

Here is a modification using the Combine States() function that reads the Hidden and Excluded row states and then reapplies them along with the Marker State to the row.

Names Default To Here( 1 );
dt = Current Data Table();
For( i = 1, i <= N Rows( dt ), i++,
	If(
		dt:AnnotateColumn[i] == "red",
			Row State( i ) = Combine States(
				Marker State( 8 ),
				Excluded State( Excluded( Row State( i ) ) ),
				Hidden State( Hidden( Row State( i ) ) )
			),
		dt:AnnotateColumn[i] == "blue",
			Row State( i ) = Combine States(
				Marker State( 3 ),
				Excluded State( Excluded( Row State( i ) ) ),
				Hidden State( Hidden( Row State( i ) ) )
			)
	)
);
Jim
0 Kudos
3 REPLIES 3
txnelson
Super User

Re: A phrase in a Column to a marker

Here is a simple script that reads information from your column that has the annotations, I refer to it as "AnnotateColumn", and changes the marker based upon the value in the annotate column.

Names Default To Here( 1 );
dt = Current Data Table();
For( i = 1, i <= N Rows( dt ), i++,
	If(
		dt:AnnotateColumn[i] == "red",
			Row State( i ) = Marker State( 8 ),
		dt:AnnotateColumn[i] == "blue",
			Row State( i ) = Marker State( 3 )
	)
);


 This is all documented in the Scripting Index

     Help==>Scripting Index............search for "marker"

Jim
0 Kudos
rshehadah
Community Trekker

Re: A phrase in a Column to a marker

Thank you this works!

 

However is there a way that when I run the script it does not un hide/exlcude rows. Right now when I run it, the rows that I am hiding or exclduing are not excluded anymore.

 

Thank you,

Rami

0 Kudos
txnelson
Super User

Re: A phrase in a Column to a marker

Here is a modification using the Combine States() function that reads the Hidden and Excluded row states and then reapplies them along with the Marker State to the row.

Names Default To Here( 1 );
dt = Current Data Table();
For( i = 1, i <= N Rows( dt ), i++,
	If(
		dt:AnnotateColumn[i] == "red",
			Row State( i ) = Combine States(
				Marker State( 8 ),
				Excluded State( Excluded( Row State( i ) ) ),
				Hidden State( Hidden( Row State( i ) ) )
			),
		dt:AnnotateColumn[i] == "blue",
			Row State( i ) = Combine States(
				Marker State( 3 ),
				Excluded State( Excluded( Row State( i ) ) ),
				Hidden State( Hidden( Row State( i ) ) )
			)
	)
);
Jim
0 Kudos