<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dynamic Coding Problem in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Dynamic-Coding-Problem/m-p/807038#M98581</link>
    <description>&lt;P&gt;Are you possibly looking something like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

data_window = New Window("Down Time Exceeding 5mins",
	&amp;lt;&amp;lt;Size Window(1000, 600),
	H List Box(
		Outline Box("foo", 
			ownerbox = dt &amp;lt;&amp;lt; Get as Report()
		)
	)
);

tb = ownerbox[Table Box(1)];
tb &amp;lt;&amp;lt; append(cb_alarms = Col Box("Pull Alarms"));

For Each Row(dt,
	Eval(EvalExpr(
		cb_alarms &amp;lt;&amp;lt; Append(
			Button Box("Pull Alarms",
				tb &amp;lt;&amp;lt; Set Selected Rows(Matrix(Expr(Row())));
				show("foo Alarms for rows " || char(Expr(Row())));
				/*
				dt_temp = Get Data Table("foo Alarms for rows " || char(Expr(Row())));
				dt_temp &amp;lt;&amp;lt; ShowWindow(1);
				dt_temp &amp;lt;&amp;lt; Bring Window To Front;
				*/
			);
		)
	));
);

Write();&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 19 Oct 2024 12:22:21 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-10-19T12:22:21Z</dc:date>
    <item>
      <title>Dynamic Coding Problem</title>
      <link>https://community.jmp.com/t5/Discussions/Dynamic-Coding-Problem/m-p/807026#M98578</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;Looking for tips on how to make my script more dynamic.&lt;BR /&gt;&lt;BR /&gt;Given the snippet below we have a data table &amp;lt;&amp;lt; Get as Report that we add onto a Col Box() with dynamic buttons.&lt;BR /&gt;&lt;BR /&gt;Now, here lies the issue. I need to put X amount of data tables into my window and I'm not sure how to go about it since I also need to add dynamic buttons to each table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The exact amount of data tables can vary.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;	data_window = New Window("Down Time Exceeding 5mins",
		&amp;lt;&amp;lt; Size Window( 1000, 600 ),
		H List Box(
			OutLine Box ("foo",
				dt_Rpt = dt_dt &amp;lt;&amp;lt; Get as Report();
			)
		)
	);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        tb = dt_Rpt[Table Box( 1 )];
	tb &amp;lt;&amp;lt; append(
		bb = col box("Pull Alarms")		
	);
	
	bblist = {};
	for (i = 1, i&amp;lt;=N Rows(dt_dt), i++,
		bb_expr = evalinsert("\[bblist[i] = buttonbox("Pull Alarms", 
			tb &amp;lt;&amp;lt; Set Selected Rows(Matrix({^i^}));

			dt = Get Data Table( "foo Alarms for rows " || char(^i^));

			dt &amp;lt;&amp;lt; ShowWindow( 1 );

			dt &amp;lt;&amp;lt; Bring Window To Front;
		)]\");
		eval(parse(bb_expr));
		bb &amp;lt;&amp;lt; append(bblist[i]);
	);&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 Oct 2024 08:24:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Dynamic-Coding-Problem/m-p/807026#M98578</guid>
      <dc:creator>aharro</dc:creator>
      <dc:date>2024-10-19T08:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Coding Problem</title>
      <link>https://community.jmp.com/t5/Discussions/Dynamic-Coding-Problem/m-p/807037#M98580</link>
      <description>&lt;P&gt;Create a function to generate a data table with buttons:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Define Function( Create_Data_Table_With_Buttons( dt_name, window_title ),
    dt_Rpt = dt_name &amp;lt;&amp;lt; Get as Report();
    tb = dt_Rpt[Table Box( 1 )];
    tb &amp;lt;&amp;lt; append(
        bb = col box("Pull Alarms")
    );
    
    bblist = {};
    for (i = 1, i &amp;lt;= N Rows(dt_name), i++,
        bb_expr = evalinsert("\[bblist[i] = buttonbox("Pull Alarms", 
            tb &amp;lt;&amp;lt; Set Selected Rows(Matrix({^i^}));
            dt = Get Data Table( "^window_title^ Alarms for rows " || char(^i^));
            dt &amp;lt;&amp;lt; ShowWindow( 1 );
            dt &amp;lt;&amp;lt; Bring Window To Front;
        )]\");
        eval(parse(bb_expr));
        bb &amp;lt;&amp;lt; append(bblist[i]);
    );
    
    return dt_Rpt;
);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create a list of data table names and their corresponding window titles:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data_table_info = {
    {"dt_1", "Down Time Exceeding 5mins"},
    {"dt_2", "Another Data Table1"},
    {"dt_3", "Another Data Table2"}
};&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use a loop to create multiple OutLine boxes with data tables and buttons:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data_window = New Window("Multiple Data Tables",
    &amp;lt;&amp;lt; Size Window( 1000, 600 ),
    H List Box(
        V List Box(
            for(i = 1, i &amp;lt;= N Items(data_table_info), i++,
                OutLine Box(data_table_info[i][2],
                    Create_Data_Table_With_Buttons(
                        Eval(data_table_info[i][1]),
                        data_table_info[i][2]
                    )
                )
            )
        )
    )
);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Oct 2024 10:48:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Dynamic-Coding-Problem/m-p/807037#M98580</guid>
      <dc:creator>LinkageFrog</dc:creator>
      <dc:date>2024-10-19T10:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Coding Problem</title>
      <link>https://community.jmp.com/t5/Discussions/Dynamic-Coding-Problem/m-p/807038#M98581</link>
      <description>&lt;P&gt;Are you possibly looking something like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

data_window = New Window("Down Time Exceeding 5mins",
	&amp;lt;&amp;lt;Size Window(1000, 600),
	H List Box(
		Outline Box("foo", 
			ownerbox = dt &amp;lt;&amp;lt; Get as Report()
		)
	)
);

tb = ownerbox[Table Box(1)];
tb &amp;lt;&amp;lt; append(cb_alarms = Col Box("Pull Alarms"));

For Each Row(dt,
	Eval(EvalExpr(
		cb_alarms &amp;lt;&amp;lt; Append(
			Button Box("Pull Alarms",
				tb &amp;lt;&amp;lt; Set Selected Rows(Matrix(Expr(Row())));
				show("foo Alarms for rows " || char(Expr(Row())));
				/*
				dt_temp = Get Data Table("foo Alarms for rows " || char(Expr(Row())));
				dt_temp &amp;lt;&amp;lt; ShowWindow(1);
				dt_temp &amp;lt;&amp;lt; Bring Window To Front;
				*/
			);
		)
	));
);

Write();&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 Oct 2024 12:22:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Dynamic-Coding-Problem/m-p/807038#M98581</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-10-19T12:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Coding Problem</title>
      <link>https://community.jmp.com/t5/Discussions/Dynamic-Coding-Problem/m-p/807062#M98587</link>
      <description>&lt;P&gt;Thanks!! Didn't even think about using several functions. I thought I might have to create some gigantic headache string to parse, but this totally worked.&lt;BR /&gt;&lt;BR /&gt;I have a function that creates the data tables for each string in my query list. Then I pass the dt to another function that&amp;nbsp;&lt;BR /&gt;appends Lbox which creates the report in my window&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;window = expr(
	nw = New Window("Down Time Exceeding 5mins",
		&amp;lt;&amp;lt; Size Window( 1500, 800 ),
		Lbox = Line Up Box(Spacing(5),
			N Col(3),
		)
	);
);

eval(window);
nw &amp;lt;&amp;lt;Bring Window To Front;
create_data_tables(list_of_querys);

&lt;/PRE&gt;</description>
      <pubDate>Sun, 20 Oct 2024 00:00:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Dynamic-Coding-Problem/m-p/807062#M98587</guid>
      <dc:creator>aharro</dc:creator>
      <dc:date>2024-10-20T00:00:45Z</dc:date>
    </item>
  </channel>
</rss>

