Choose Language Hide Translation Bar
Community Trekker

varying behavior of Summary in JSL?

Can someone explain this?

dt=newtable("test", Add Rows( 8 ),
New Column( "A",Character,Nominal,Set Selected,
Set Values({"apple", "apple", "apple", "apple", "pear", "pear", "pear", "pear"})
New Column( "B",Character,Nominal,
Set Values({"red", "green", "red", "yellow", "yellow", "yellow", "pink", "pink"})


//first way - this summarizes everything, not just apple rows


//second way - this summarizes only apple rows like I wanted



I can just use the second way but I don't understand this behavior. Why doesn't Where work the same?  Is there some smarter way to get the B values for just apple rows?

0 Kudos

Re: varying behavior of Summary in JSL?

Note that summary itself does not parse the where clause.

In the first case, you are sending the summary message to the data table dt.

Summary resolves what it understands, which in this case is the grouping column.

The second case behaves like a platform. The platform resolves the data table and sends the message to it.

In this case, the data table is the subset where :A=="apple".

0 Kudos
Community Trekker

Re: varying behavior of Summary in JSL?

Interesting.  That makes me wonder if there are other commands that I can make "behave like a platform" by not sending them as messages.  And what different behaviors that would make possible. The platforms (like FitYbyX say) seem to behave the same whether sent as a message to a table or not but maybe there are also differences there?  If I say dt<<Bivariate(..) am I making a platform behave as a command in some way that might make any difference?  ( I do that all the time as it seems a less cumbersome way to make sure I'm talking to the correct table).

0 Kudos