-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6e27edb
Showing
12 changed files
with
221 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 jthi0 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Create Order Column | ||
| [Description](#description) | [Usage and Execution](#usage-and-execution) | [Possible future features](#possible-future-features) | | ||
|
||
## Description | ||
|
||
This tool will create Ordering column to datatable with current row numbers. This is useful when you are starting analysis and want to sort the data, but still have possibility to roll-back to original order. The column will be created in the start of datatable and if multiple ordering columns are created, indexing is added. | ||
|
||
## Usage and Execution | ||
When user executes the tool, it will create new column to current datatable. The name of column and it's properties can be managed in *settings.json*. | ||
|
||
### Two index columns created as hidden and excluded | ||
 | ||
|
||
|
||
### Options | ||
User has access to following options directly from the user interface: | ||
|
||
| Option | Description | Values | | ||
| -------------- | ------------------------------------------------------ | ------ | | ||
| hide_column | If enabled will set the ordering column as hidden | 0,1 | | ||
| exclude_column | If enabled will set the ordering column as excluded | 0,1 | | ||
| order_col_name | String which will be used to name the ordering columns | String | | ||
|
||
## Possible future features | ||
* Create custom function `create_ordering_column(dt = Current Data Table(), int_hide = 1, int_exclude = 1, col_name = "_OrigOrder_")` | ||
* Try to fix how JMP behaves when new columns are created as it might leave user in the last column. Might have to add check for all selected columns and then return to one of those or something... | ||
* JMP seems to work irrational with this and sometimes obey the *<<Next Selected Column* and sometimes it doesn't |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
id=jthi.jmp.tools.create.order.column | ||
name=JMP-Tools Create Order Column | ||
supportJmpSE=0 | ||
addinVersion=1 | ||
minJmpVersion=16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!-- JMP Add-In Builder created --><jm:menu_and_toolbar_customizations xmlns:jm="http://www.jmp.com/ns/menu" version="3"> | ||
<jm:insert_in_main_menu> | ||
<jm:insert_in_menu> | ||
<jm:name>Add-Ins</jm:name> | ||
<jm:insert_after> | ||
<jm:name></jm:name> | ||
<jm:menu> | ||
<jm:name>JMP-TOOLS</jm:name> | ||
<jm:caption>JMP-Tools</jm:caption> | ||
<jm:command> | ||
<jm:name>CREATE ORDER COLUMN</jm:name> | ||
<jm:caption>Create Order Column</jm:caption> | ||
<jm:action type="text">Names Default To Here(1); | ||
Include("$ADDIN_HOME(jthi.jmp.tools.create.order.column)/create_order_column_gui.jsl");</jm:action> | ||
<jm:tip>Run Create Order Column of JMP-Tools created by @jthi</jm:tip> | ||
<jm:icon type="builtin">NumericColumn</jm:icon> | ||
</jm:command> | ||
</jm:menu> | ||
</jm:insert_after> | ||
</jm:insert_in_menu> | ||
</jm:insert_in_main_menu> | ||
</jm:menu_and_toolbar_customizations> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Names Default To Here(1); | ||
|
||
create_ordering_column = function({dt = Current Data Table(), int_hide = 1, int_exclude = 1, order_col_name = "_OrigOrder_"}, {Default Local}, | ||
/************************************************************************* | ||
Function: create_ordering_column | ||
---Prototype--- | ||
create_ordering_column(datatable dt, int int_hide, int int_exclude, str order_col_name) | ||
--------------- | ||
Function to create ordering column based on curent order of the datatable | ||
|
||
Returns: | ||
Reference to new column | ||
|
||
Prototype: | ||
> create_ordering_column(dt, <int_hide = 1>, <int_excluide = 1>, <order_col_name = "_OrigOrder_">) | ||
|
||
Parameters: | ||
dt - reference to datatable | ||
int_hide - 0/1 to determine if column should be hidden by default | ||
int_exclude - 0/1 to determine if column should be excluded by default | ||
order_col_name - Name for the created column | ||
|
||
Examples: | ||
----------JSL----------- | ||
------------------------ | ||
*************************************************************************/ | ||
note_str = "Ordering for " || (dt << Get Name) || " " ||Char(AsDate(Today())); | ||
row_col = dt << New Column(order_col_name, Numeric, "Ordinal", Set Property("Notes", note_str), Hide(int_hide == 1), Exclude(int_exclude == 1), | ||
<< Set Each Value(Row()) | ||
); | ||
order_col_name_idx = row_col << get name; | ||
col_idx = Word(2,order_col_name_idx); | ||
If(col_idx == "", | ||
dt << Move Selected Columns(row_col, To First); | ||
, col_idx == "2", | ||
dt << Move Selected Columns(row_col, After(Column(order_col_name))); | ||
, //else | ||
prev_order_col_name = order_col_name || char(Num(col_idx) - 1); | ||
dt << Move Selected Columns(row_col, After(Column(prev_order_col_name))); | ||
); | ||
return(row_col); | ||
|
||
); | ||
Write(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
Names Default To Here(1); | ||
|
||
check_data_tables = function({}, {Default Local}, | ||
If(N Items(Get Data Table List()) == 0, | ||
mini_modal_window("Error", "No datatables open", text_icon = "Error", window_icon = "ErrorSmall"); | ||
stop(); | ||
); | ||
return(Current Data Table()); | ||
); | ||
|
||
check_open_window = function({window_title, show_modal = 0}, {Default Local}, | ||
If(Contains(Get Window List() << get window title, window_title), | ||
If(show_modal, | ||
mini_modal_window("Window already open", | ||
"Window " || window_title || " already open.\!NBringing to front.", | ||
"WinInformation", | ||
"Warning" | ||
); | ||
); | ||
move_window(Window(window_title)); | ||
stop(); | ||
write(); | ||
); | ||
); | ||
|
||
mini_modal_window = function({title, text, text_icon = "BlankIndex", window_icon = "NewApplication"}, {Default Local}, | ||
New Window(title, <<modal, << show toolbars(0), << show menu(0), << Set Window Icon(window_icon), | ||
H List Box( | ||
Icon Box(text_icon), | ||
Spacer Box(size(10, 1)), | ||
V Center Box(Text Box(text)) | ||
) | ||
); | ||
); | ||
|
||
load_settings = function({default_settings = Associative Array(), settings_file_name = "settings.json"}, {Default Local}, | ||
If(File Exists(settings_file_name), | ||
settings = Load Text File("settings.json", JSON), | ||
settings = default_settings; | ||
); | ||
return(settings); | ||
); | ||
|
||
get_nw_values = function({window_ref},{Default Local}, | ||
nw_aa = Associative Array(); | ||
nw_aa["clbs"] = Transform Each({clb}, Substr(window_ref << Xpath("//ListBoxBox"),2), clb << get items); | ||
nw_aa["tebs"] = Transform Each({teb}, (window_ref << Xpath("//TextEditBox")), teb << get text); | ||
nw_aa["nebs"] = Transform Each({neb}, (window_ref << Xpath("//NumberEditBox")), neb << get); | ||
nw_aa["cbs"] = Transform Each({neb}, (window_ref << Xpath("//CheckBoxBox")), neb << get); | ||
nw_aa["rbs"] = Transform Each({neb}, (window_ref << Xpath("//RadioBox")), neb << get); | ||
return(nw_aa); | ||
); | ||
|
||
move_window = function({nw}, {Default Local}, | ||
nw << Show Window(0); | ||
|
||
Try( | ||
cur_window_pos = Current Window() <<Get Window Position(); | ||
cur_window_size = Current Window() <<Get Window Size(); | ||
nw << move window( | ||
cur_window_pos[1] + cur_window_size[1] / 2 - (nw << Get Window Size)[1] / 2, | ||
cur_window_pos[2] + cur_window_size[2] / 2 - (nw << Get Window Size)[2] / 2 | ||
); | ||
); | ||
nw << Bring Window To Front; | ||
nw << Show Window(1); | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Names Default To Here(1); | ||
|
||
If(N Items(Get Data Table List()) < 1, | ||
Throw("No datatables open"); | ||
); | ||
|
||
Include("bin/create_order_column.jsl"); | ||
|
||
default_settings = ["hide_column" => 1,"exclude_column" => 1, "order_col_name" => "_OrigOrder_"]; | ||
If(File Exists("settings.json"), | ||
aa_settings = Load Text File("settings.json", JSON); | ||
aa_settings = default_settings; | ||
); | ||
|
||
create_ordering_column(dt = Current Data Table(), aa_settings["hide_column"], aa_settings["exclude_column"], aa_settings["order_col_name"]); | ||
Write(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* DO NOT EDIT THIS FILE YOURSELF AS IT IS CHANGED BY ADD-IN MANAGER */ | ||
|
||
Associative Array( | ||
List( | ||
List( "addinVersion", 1 ), | ||
List( "author", "jthi" ), | ||
List( "buildDate", 3725188771 ), | ||
List( "deployedAddinsFilename", "publishedAddins.jsl" ), | ||
List( "deployedAddinsLoc", "" ), | ||
List( "id", "jthi.jmp.tools.create.order.column" ), | ||
List( "name", "JMP-Tools Create Order Column" ), | ||
List( "state", "DEV" ) | ||
) | ||
) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"hide_column": 1, | ||
"exclude_column": 1, | ||
"order_col_name": "_OrigOrder_" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.