Execute a custom function when the condition satisfied in nested if
Once the condition satisfied only one function are executed which exports graphs into a window
Here's my sample code :
//list box
graph_chk_val = chk_graph << get selected;
tab_chk_val = chk_tab<< get selected;
anal_chk_val = chk_analysis << get selected;
list_selected = graph_chk_val || tab_chk_val || anal_chk_val;
dt = table;
for(
i = 1, i <= n items(list_selected), i++,
if(
"SDET Chart" == list_selected[i], show("SDET"),
"Sensitiviity" == list_selected[i], sens_graph_exe(),
"Sensitivity CDF" == list_selected[i], sens_cdf_graph_exe(),
"Parametric Boxplot" == list_selected[i], parametric_boxplot_graph_exe(),
);
);
ScriptingRe: Execute a custom function when the condition satisfied in nested ifI am not sure I understand what you are trying to achieve here; what part of your code is not working? Do you want to combine sens_graph_exe and sens_cdf_graph_exe into a single function?
Re: Execute a custom function when the condition satisfied in nested ifthank you for your response, the code and the function are working, the result that I want, is to execute all the function that satisfies the condition, but only one function is called. I tried to debug using print("function1") in every condition, and they are all working, but when i use a function, only the first selected function are called.
Re: Execute a custom function when the condition satisfied in nested ifI think it is because i use 1 datatable for all the function which creates graph and make a data analysis, but when i called them without using a nested if statement they are all working.
Re: Execute a custom function when the condition satisfied in nested ifHere is your code along with a simple window containing check boxes. When I run this I get one formula evaluation per box that is checked. Is this your expected behavior?
names default to here(1);
//Window with check boxes
win = New Window( "Check Boxes",
h list box(
chk_graph = check box( { "A", "B" } ),
chk_tab = check box( { "C", "D" } ),
chk_analysis = check box( { "E", "F" } )
);
);
//get check box values
graph_chk_val = chk_graph << get selected;
tab_chk_val = chk_tab << get selected;
anal_chk_val = chk_analysis << get selected;
list_selected = graph_chk_val || tab_chk_val || anal_chk_val;
//For each list item
For( i = 1, i <= N Items( list_selected ), i++,
Write( "\!NList Item " || char(i) || ": " );
//Evaluate a single function based on the item's value
If(
"A" == list_selected[i], Write( "A" ),
"B" == list_selected[i], Write( "B" ),
"C" == list_selected[i], Write( "C" ),
"D" == list_selected[i], Write( "D" ),
"E" == list_selected[i], Write( "E" ),
"F" == list_selected[i], Write( "F" )
)
);Re: Execute a custom function when the condition satisfied in nested ifNo.
Re: Execute a custom function when the condition satisfied in nested if Can you explain what you do expect to happen in this example, perhaps by explaining what you would expect to show up in the log and in which order? I apologize as I do not understand what you are trying to do.