Posso pubblicare il codice JSLGet DOE Factor Names = Function({table},{Default Local},
lstFactors = {};
dt = Open(table);
For (i=1,i<=NCols(dt),i++,
col = Column(dt,i);
colName = col << Get Name;
changes = col << Get Property("Factor Changes");
If (!IsEmpty(changes),
InsertInto(lstFactors,colName)
);
);
Close(dt,NoSave);
Return(lstFactors);
);
The "insert code" icon seems to do its job. There is also a link to a "jsl syntax highlighter" but I hot lost with that one.Re: Posso postare il codice JSL@stan_koprowski è giusto. Manca l'icona per il pulsante Inserisci codice JSL ma la funzionalità funziona ancora.
Fai clic sullo spazio tra il codice di inserimento e i pulsanti di inserimento del collegamento e otterrai una finestra di dialogo in cui puoi incollare il tuo codice JSL. Apparirà non formattato fino a quando non lo pubblichi ma poi, proprio come Dorothy che atterra a Oz, tutto sarà a colori.
Ecco un esempio:
/*
TIMING CHART CREATOR
jay holavarri 10-13-2016
Requires a table with the columns Component, Start, End.
*/
Names Default to Here(1);
dt=current datatable();
maxTime = ColMax(:End);
Summarize(dt, compList = By(:Component));
dt2 = New Table("Timing Chart");
New Column("Component_", Character);
colTime = New Column("Time (ms)");
New Column("Bit Status");
Current Data Table(dt);
catListAll = {};
timeIndexAll = [];
timeIndex0 = Index(0, maxTime, 10);
bitMatrix = [];
//Loop for ON time of each component
For(i=1, i<=N Rows(dt), i++,
timeIndex = Index(:Start[i],:End[i],10);
timeRows = N Cols(timeIndex);
catString = Repeat(:Component[i] || ",", timeRows);
catList = Words(catString, ",");
InsertInto(catListAll, catList);
timeIndexAll = Concat(timeIndexAll, timeIndex);
bitMatrix ||= J(1, timeRows, 1);
);
//Loop for OFF time of each component. Note that it puts a 0 for every available time,
//and the 1's appear in the chart by using the Max function in Graph Builder
For(i=1, i<= N Items(compList), i++,
timeRows0 = N Cols(timeIndex0);
catString0 = Repeat(compList[i] || ",", timeRows0);
catList0 = Words(catString0, ",");
InsertInto(catListAll, catList0);
timeIndexAll = Concat(timeIndexAll, timeIndex0);
bitMatrix ||= J(1, timeRows0, 0);
);
//Write to the datatable
dt2:Component_ << Set Values(catListAll);
colTime << Set Values(timeIndexAll);
dt2:bitStatus << Set Values(bitMatrix);
dt2 << Graph Builder(
Variables( X( :Name( "Time (ms)" ) ), Y( :Bit Status ), Group Y( :Component_ ) ),
Elements( Line( X, Y, Legend( 25 ), Summary Statistic( "Max" ) ) )
);Re: Posso postare il codice JSLSì, l'evidenziatore di sintassi JSL sembra essere in vacanza al momento.
Normalmente apparirebbe tra l'icona di inserimento del codice e l'icona di inserimento del collegamento.
Re: Posso postare il codice JSL(utilizzando il pulsante di risposta rapida)
ma mantenere la formattazione del colore sarebbe davvero utile. In altre parole, avere un forum di discussione fortemente incentrato sul linguaggio di scripting deve essere compatibile con il codiceRe: Posso postare il codice JSL(utilizzando il pulsante di risposta)
Quindi sono contento che non dobbiamo ricorrere al solito metodo di taglia e incolla tramite MS-Word, ma sarebbe bello se funzionasse ancora
Re: Posso postare il codice JSLEcco il codice pubblicato nel "solito" modo (copia/incolla in MS-Word e poi qui). Perde tutta la formattazione:
// Questo è un commento
un = 123 ;
per ( K = 1 , K <= 99 , K++,
m = k^ 2 ;
) ;
Questo è il codice pubblicato con il pulsante Inserisci codice. Perde la colorazione della sintassi.
// This is a comment
a = 123;
for (k = 1, k <= 99, k++,
m = k^2;
);