Subscribe Bookmark RSS Feed

How to apply Column Properties to an existing Data Table Column

saitcopuroglu

Community Trekker

Joined:

Sep 29, 2014

I created a summary table and one of the columns need Value Ordering. The script to create a column with properties says:

New Column( "Contract",

  Character( 4 ),

  Nominal,

  Set Property(

  "Value Ordering",

  {"CIS", "LOC", "WEU", "UK", "EEU", "MEA", "GRP", "OTH", "NRD", "DIR",

  "COR", "COMP"}

  ),

  Set Selected,

  Set Values(

  {"CIS", "LOC", "WEU", "UK", "EEU", "MEA", "GRP", "OTH", "NRD", "DIR",

  "COR", "COMP"}

  )

  )


However, I would not like to create the table from scratch but apply the value ordering to the summary table column (hence the summary table is dynamic), where should I insert the script of just adding value ordering to an existing script:


Data Table( "AccomodationBudget.jmp" ) << Summary(

  Group( :Contract ),

  Sum( :RoomNight ),

  Sum( :AdultNight ),

  Sum( :NetRoomRevenueWithOutVat ),

  Subgroup( :Label ),

  Link to original data table( 0 )

  ),

  New Column( "MinADRMarket",

  Numeric,

  Continuous,

  Format( Currency( "EUR" ), 17, 2 ),

  Formula(

  (:Name( "Sum(NetRoomRevenueWithOutVat, Budget)" ) -

  :Name( "Sum(NetRoomRevenueWithOutVat, 2015)" )) / (:Name( "Sum(RoomNight, Budget)" )

   - :Name( "Sum(RoomNight, 2015)" ))

  )

  ),

  New Column( "MinADBMarket",

  Numeric,

  Continuous,

  Format( Currency( "EUR" ), 17, 2 ),

  Formula(

  (:Name( "Sum(NetRoomRevenueWithOutVat, Budget)" ) -

  :Name( "Sum(NetRoomRevenueWithOutVat, 2015)" )) / (:Name( "Sum(AdultNight, Budget)" )

   - :Name( "Sum(AdultNight, 2015)" ))

  )

  ),

3 REPLIES
ms

Super User

Joined:

Jun 23, 2011

The value ordering property is inherited by a linked summary table. So if you set the value ordering to your main table, every summary table will get it too.

The code below sets value ordering to the main table or the summary table (it depends on which table that is the "Current Data Table").  Btw, once you have more than open table I recommend defining variables for the data tables affected by the script (i.e. like dt = data table("name"); dt_sum=dt<<Summary(...);). They make it much easier to control the the script execution.

Column( "Contract" ) << Set Property(

    "Value Ordering",

    {"CIS", "LOC", "WEU", "UK", "EEU", "MEA", "GRP", "OTH", "NRD", "DIR", "COR",

    "COMP"}

);



saitcopuroglu

Community Trekker

Joined:

Sep 29, 2014

Should I link the summary table to main data table for column properties to carry over or independent of choice?

ms

Super User

Joined:

Jun 23, 2011

Typically, the summary table is linked by default. If you uncheck the "link" check box it will not be linked (i.e. dynamic, interactive...) and I think the value ordering property then will be lost.