- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Insert Hyperlink in Text in the cells
Hi,
I am creating data table report, save it as html file and then distribute it to my team for review.
In the data table cells, I would like to insert hyperlink to the text (e.g. Report) in the cells, as shown in below example.
This can done easily in MS Excel.
Is there a way to do this in JMP through JSL? I am using JMP 12.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Insert Hyperlink in Text in the cells
I have had to do something like this year or two ago. I started by saving jmp table as html report, then taking a look at the source code and then figuring out how I should modify it. There might also be better ways to do this, but maybe this will help you (this has been tested with JMP15.2, so not sure if it will work with JMP12):
Approximate flow:
- Create new column (URL) with html a href
- Create new window with outline box
- Append the datatable as a report to the outline box
- Get html string out of the outline box
- Using regex replace <, >, \!" with corresponding html entities
- Save the modified html string to desired location
Example code:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << New Column("URL",
Character,
"Nominal",
Formula("<a href=\!"file://" || :name || ".html\!" target=\!"_blank\!">"||:name||"</a>"),
);
nw = New Window("",
ob = OutlineBox();
);
ob << Append(dt << get as report);
htmlString = ob << get html;
htmlString = Regex(htmlString, "<", "<", GLOBALREPLACE);
htmlString = Regex(htmlString, ">", ">", GLOBALREPLACE);
htmlString = Regex(htmlString, """, "\!"", GLOBALREPLACE);
Save Text File("$TEMP/test.html",htmlString);
Result:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Insert Hyperlink in Text in the cells
I have had to do something like this year or two ago. I started by saving jmp table as html report, then taking a look at the source code and then figuring out how I should modify it. There might also be better ways to do this, but maybe this will help you (this has been tested with JMP15.2, so not sure if it will work with JMP12):
Approximate flow:
- Create new column (URL) with html a href
- Create new window with outline box
- Append the datatable as a report to the outline box
- Get html string out of the outline box
- Using regex replace <, >, \!" with corresponding html entities
- Save the modified html string to desired location
Example code:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << New Column("URL",
Character,
"Nominal",
Formula("<a href=\!"file://" || :name || ".html\!" target=\!"_blank\!">"||:name||"</a>"),
);
nw = New Window("",
ob = OutlineBox();
);
ob << Append(dt << get as report);
htmlString = ob << get html;
htmlString = Regex(htmlString, "<", "<", GLOBALREPLACE);
htmlString = Regex(htmlString, ">", ">", GLOBALREPLACE);
htmlString = Regex(htmlString, """, "\!"", GLOBALREPLACE);
Save Text File("$TEMP/test.html",htmlString);
Result:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Insert Hyperlink in Text in the cells
Not useful in the context of JMP 12, but just to point out that the Event Handler column property now allows this (and a lot more).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Insert Hyperlink in Text in the cells
I will explore it if it available in JMP 12.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Insert Hyperlink in Text in the cells
This is great.
It works for JMP 12.