Puedo publicar código 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: ¿Puedo publicar código JSL @stan_koprowski es correcto. Falta el icono del botón Insertar código JSL pero la funcionalidad aún funciona.
Haga clic en el espacio entre el código de inserción y los botones de enlace de inserción y obtendrá un cuadro de diálogo donde puede pegar su código JSL. Aparecerá sin formato hasta que lo publiques, pero entonces, al igual que Dorothy aterrizando en Oz, todo estará en color.
Aquí hay un ejemplo:
/*
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: ¿Puedo publicar código JSLSí, el resaltador de sintaxis JSL parece estar de vacaciones en este momento.
Normalmente, aparecerá entre el icono de código de inserción y el icono de enlace de inserción.
Re: ¿Puedo publicar código JSL(usando el botón de respuesta rápida)
Pero mantener el formato de color sería realmente útil. O dicho de otra manera, tener un foro de discusión que esté tan enfocado en el lenguaje de scripting, debe ser compatible con el códigoRe: ¿Puedo publicar código JSL(usando el botón de respuesta)
Así que me alegro de no tener que recurrir al método habitual de cortar y pegar a través de MS-Word, pero sería bueno si aún funcionara.
Re: ¿Puedo publicar código JSLAquí está el código publicado de la manera "habitual" (copiar / pegar en MS-Word y luego aquí). Pierde todo el formato:
// Esto es un comentario
a = 123 ;
para ( k = 1 , k <= 99 , k ++,
m = k ^ 2 ;
) ;
Este es el código publicado con el botón insertar código. Pierde la coloración de la sintaxis.
// This is a comment
a = 123;
for (k = 1, k <= 99, k++,
m = k^2;
);