cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
0 Kudos

Add new Toolbar to File_Edit toolbar for Show XML

What inspired this wish list request?

I quite commonly have to use XPath to access JMP report layer and usually it requires using << Get XML

 

What is the improvement you would like to see? 

I would like to have a feature which would allow me to easily view the XML of report. In best case it would be interactive, if I select display box from report, it would go to starting tag of XML, and in "worst case" it could be new script window/open to similar place as Show Properties. 

 

Why is this idea important? 

Makes it easier to see what is under JMP reports as XML.

4 Comments
SamGardner
Level VII

@jthi can you explain a little more why you need this?  Do you want to get at the XML so that you where in the report structure certain information is located? 

 

Also, in case you were not aware, you can see the Xpath to a display element by using Show Properties in the report window and expanding the Box Path and choosing Xpath as the mode.  

 

SamGardner_0-1697126393756.png

 

SamGardner
Level VII

If you create an add-in that runs this code, it will create a new window with the XML for the current report.  

cr=current report();
new window("View XML",
<<Type("Script"),
<<Language("XML"),
cr << get xml
);
jthi
Super User

Hi @SamGardner ,

I know I can create my own add-in / toolbar to perform this task, but I would like it to be default feature of JMP (if the solution would be to always script my own solution, I wouldn't really post any wish list items...).

 

Basically what that script does is what I would like to have at minimum (script doesn't work for me, I suspect << Language() is upcoming JMP18 feature for New Window?). Using Properties XPath isn't enough as it isn't robust enough for general use (in my opinion). This would just make it a bit faster when customizing / getting information / manipulating JMP reports and provide additional option outside Properties toolbar button. Of course if this was to be linked to report it would be even better

jthi
Super User

I think in the end I will end up writing my own "JMP Scripting Tools" Add-in when I have time and this will be part of it. I have already written few tools for that and I do have few additional ideas.

 

Here is fairly quick and dirty version for viewing XML

Names Default To Here(1);

cur_report = Current Report();
If(!IsEmpty(cur_report),
	cur_xml = cur_report << get xml;
	If(!Contains(Get Window list() << Get Window Title, "View XML"),
		sb = Script Box(cur_xml, "XML");
		sb << show line numbers(1);
		nw = New Window("View XML",  /*<<Language("XML"), */ << Size(1600, 1000),
			V List Box(align("center"),
				window:selection = Text Box("", << Font Color("Red")),
				Panel Box("XML for '" || (cur_report << get window title) ||"'",
					sb
				)
			)
		);
		nw << Set Dirty(0);
	,
		nw = Window("View XML");
	);
	nw << Bring Window To Front;
);


// not really that good, as we cannot select the lin
sb = nw[Script Box(1)];
If(!IsEmpty(sb),
	sel_line = 0;
	For Each({line, idx}, sb << Get Lines,
		If(Contains(line, "selected=\!"true\!""),
			sel_line = idx;
			break();
		);
	);

	If(sel_line,
		is_dirty = sb << Is Dirty();
		sb << Set Line text(sel_line, sb << get line text(sel_line));
		sb << Set Dirty(is_dirty); // reset dirty status
		nw:selection << Set Text("\[First 'selected = "true"' found from line: ]\" || Char(sel_line));
	);
);