World Statistics Day was yesterday, but we’re celebrating all week long! This celebration means acknowledging the impact statistics has on our world. Who is your favorite statistician? Share with us who they are and why they top your favorites list.
Choose Language Hide Translation Bar
Highlighted
Level III

## With JSL what is the correct syntax to set the Column property "Reverse"

Hi,

I need to set the properties of a Column to 1) Row Order levels and 2) Reverse.
So far I can do the first one without any problems.

`` dt:ColXYZ <<Set Property ( "Row Order Levels", 1 );``

However I cannot find anywhere what is the correct syntax to emulate the GUI button "Reverse"

I have tried several ways but none have worked.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User

## Re: With JSL what is the correct syntax to set the Column property "Reverse"

Just to be clear, are you talking about Row Order Levels, or Value Ordering?

Row Order Levels I think just takes a flag - your screenshot looks more like value ordering, and that takes a list e.g.

``<< Set Property( "Value Ordering", {"F", "M"} ),``

Those buttons on the GUI are just utility buttons to help you create the order of the list.  They are not implemented as parameters in the message itself.  For the message you have to explicitly define the list, and ordering of the items defines the value ordering.

If you wanted to mimic the reverse logic, you need to do two things; first get a list of the unique values in the column:

``````dt = open("\$SAMPLE_DATA/Big Class.jmp");
summarize(levels=by(dt:sex));
show(levels);``````

In this example:

``levels = {"F", "M"};``

And to reverse them:

``````reverseInto(levels);
show(levels);``````

This gives

``levels = {"M", "F"};``

So now you can write

``dt:sex << setProperty("Value Ordering",levels);``

Unless of course you really did mean Row Order Levels!

-Dave
2 REPLIES 2
Highlighted
Super User

## Re: With JSL what is the correct syntax to set the Column property "Reverse"

Just to be clear, are you talking about Row Order Levels, or Value Ordering?

Row Order Levels I think just takes a flag - your screenshot looks more like value ordering, and that takes a list e.g.

``<< Set Property( "Value Ordering", {"F", "M"} ),``

Those buttons on the GUI are just utility buttons to help you create the order of the list.  They are not implemented as parameters in the message itself.  For the message you have to explicitly define the list, and ordering of the items defines the value ordering.

If you wanted to mimic the reverse logic, you need to do two things; first get a list of the unique values in the column:

``````dt = open("\$SAMPLE_DATA/Big Class.jmp");
summarize(levels=by(dt:sex));
show(levels);``````

In this example:

``levels = {"F", "M"};``

And to reverse them:

``````reverseInto(levels);
show(levels);``````

This gives

``levels = {"M", "F"};``

So now you can write

``dt:sex << setProperty("Value Ordering",levels);``

Unless of course you really did mean Row Order Levels!

-Dave
Highlighted
Level III

## Re: With JSL what is the correct syntax to set the Column property "Reverse"

Hi David,

Sorry to be so greedy, but I actually want both. So, I will first set the Row Levels for the column

`` dt:ColXYZ <<Set Property ( "Row Order Levels", 1 )``

and then implement your solution.to get the "Levels" and then Reverse them.  What a bummer that the GUI button does not represent a parameter and it is NOT documented.

Thank you very much for the info.  Nice lesson.

Best regards.

Article Labels