Col list box() non rispetta il riferimento alla tabella di datiUtilizzando JMP 14.1:
Voglio che le persone selezionino due tabelle di dati e quindi visualizzino le colonne in quelle tabelle di dati in due caselle di riepilogo col. Tuttavia, quando imposto le colonne nelle caselle, JMP imposterà solo le colonne dalla tabella dati attiva e non rispetterà l'argomento della tabella dati. Eventuali suggerimenti?
Ecco un rapido esempio di comportamento sbagliato:
dt = New Table( "Table 1",
Add Rows( 0 ),
Compress File When Saved( 1 ),
New Column( "Column 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 3",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
)
);
dtNew = New Table( "Table 2",
Add Rows( 0 ),
Compress File When Saved( 1 ),
New Column( "Column 4",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 5",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 6",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
)
);
new window("Column renamer",
h list box(
Panel box("Source table",
SourceBox = Col List Box(dt,All)
),
Panel box("Destination table",
DestBox = Col List Box(dtnew,All),
),
)
);Questo risultato è:

Il risultato atteso è che nell'elenco di sinistra vengano visualizzate le colonne 1,2,3 poiché quelli sono i nomi nella prima tabella. Invece mostra la seconda tabella (l'ultima creata e come tale la tabella attiva) due volte.
Re: Col list box() non rispetta il riferimento alla tabella dei datiInteso! Puoi fare una cosa simile con 'ColListBox()' se preferisci:
Names default to here(1);
ListOfOpenTables = sort list(Get Data Table List());
updateCLB =
Expr(
Try(clb << delete);
thisTable = (tlb << getSelected)[1];
CMD = Expr(nw << Append(clb = ColListBox(DataTable(tableTBD), All, maxSelected(1), clbAction)));
SubstituteInto(CMD, Expr(tableTBD), Eval(thisTable));
CMD;
);
clbAction =
Expr(
Speak("Column "||(clb << getSelected)[1]||" was selected.");
);
nw = NewWindow("Test", tlb = ListBox(ListOfOpenTables, maxSelected(1), updateCLB));
Re: Col list box() non rispetta il riferimento alla tabella dei datiSì, con l'utilizzo di una casella di riepilogo standard l'ho fatto funzionare, ma non sembra che le finestre di dialogo di selezione delle colonne vengano utilizzate normalmente da JMP. E non mostra il raggruppamento delle colonne dalla tabella dei dati. Quindi vorrei implementarlo con la casella di riepilogo col
Re: Col list box() non rispetta il riferimento alla tabella dei datiScusa Paul, non ho avuto il tempo di capire le sfumature di quello che stai cercando di fare.
Ma ecco un vecchio frammento di codice che potrebbe avvicinarti (non usando 'ColListBox()'):
Names default to here(1);
ListOfOpenTables = sort list(Get Data Table List());
updateCLB =
Expr(
thisTable = (tlb << getSelected)[1];
CMD = Expr(cols = DataTable(tableTBD) << getColumnNames("String"));
SubstituteInto(CMD, Expr(tableTBD), Eval(thisTable));
CMD;
clb << setItems(cols);
);
clbAction =
Expr(
Speak("Column "||(clb << getSelected)[1]||" was selected.");
);
nw = NewWindow("Test",
tlb = ListBox(ListOfOpenTables, maxSelected(1), updateCLB),
clb = ListBox({"Pick a table above"}, maxSelected(1), clbAction)
);Re: Col list box() non rispetta il riferimento alla tabella dei datiCiao Ian, grazie per il tuo aiuto ma in effetti non risolve il mio problema. Ecco un frammento di codice più grande di ciò che sto veramente cercando di fare. Quindi selezioni due tabelle diverse dalle tabelle aperte e quando selezioni una tabella diversa l'elenco delle colonne sottostante si popola con le colonne delle tabelle selezionate:
Names default to here(1);
ListOfOpenTables = sort list(Get Data Table List());
ColumnWidth = 300;
new window("Column renamer",
h list box(
Panel box("Source table",
v list box(
FirstDT = List box(ListOfOpenTables, maxSelected(1), width(ColumnWidth),
dt = Data Table((FirstDT << get selected())[1]);
SourceBox << Set items(Data Table((FirstDT << get selected())[1]) << Get Column Names("String"));
),
SourceBox = Col List Box(,nlines(40), width(ColumnWidth),
OldCounter << set text(char(n items(SourceBox << get selected())) || " Columns selected");
dt << Select columns(SourceBox << get selected());
),
OldCounter = Text Box("")
)
),
Panel box("Destination table",
v list box(
SecondDT = List box(ListOfOpenTables, maxSelected(1), width(ColumnWidth),
dtnew = Data Table((SecondDT << get selected())[1]);
DestBox << Set items(Data Table((SecondDT << get selected())[1]) << Get Column Names("String"));
),
DestBox = Col List Box(,nlines(40), width(ColumnWidth),
NewCounter << set text(char(n items(DestBox << get selected())) || " Columns selected");
dtnew << Select columns(DestBox << get selected())
),
NewCounter = Text Box("")
)
),
Panel box("Actions",
v list box(
button box("Change column names",DoTheWork),
button box("Undo",Undo)
)
)
)
);Re: Col list box() non rispetta il riferimento alla tabella dei datiNon risponde alla tua vera domanda, ma funziona (JMP 14.2 su Mac):
dt = New Table( "Table 1",
Add Rows( 0 ),
Compress File When Saved( 1 ),
New Column( "Column 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 3",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
)
);
dtNew = New Table( "Table 2",
Add Rows( 0 ),
Compress File When Saved( 1 ),
New Column( "Column 4",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 5",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 6",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
)
);
new window("Column renamer",
h list box(
Panel box("Source table",
SourceBox = Col List Box(DataTable( "Table 1"),All)
),
Panel box("Destination table",
DestBox = Col List Box(DataTable( "Table 2"),All),
),
)
);