Highlight selected portions of text in table cell?<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />I know that you can color table cells, but I need to do something a bit different.
Is it possible to highlight selected portions of text in a table cell? Something like this:

If this is possible with a tablebox that would be a workable solution as well.
Re: Highlight selected portions of text in table cell?A coworker figured out a slick way to highlight things using the < method. Run the code below and search for a term. For example here's a search for bacon:

my_narr = "Bacon ipsum dolor amet sirloin short loin meatloaf doner, shoulder swine brisket bacon pig boudin alcatra ham hock chuck hamburger corned beef. Pork chop landjaeger sausage frankfurter biltong doner pork loin ham pastrami fatback sirloin. Brisket prosciutto corned beef short ribs. Ball tip filet mignon shoulder, landjaeger corned beef fatback cow shank venison pork chop bacon meatball bresaola leberkas. Tri-tip short ribs andouille tail prosciutto doner swine ground round meatloaf pancetta boudin.
Brisket beef bacon, landjaeger beef ribs tenderloin alcatra t-bone short ribs venison fatback capicola picanha pig. Salami brisket doner drumstick pork loin shank chicken corned beef short ribs chuck meatball t-bone. Andouille frankfurter rump strip steak landjaeger bacon beef ham hock hamburger flank picanha. Brisket short loin flank hamburger pork belly sausage bresaola doner. Biltong prosciutto jerky, spare ribs porchetta picanha rump pork swine pork loin cupim.";
highlight_txt_expr = Expr(
highlight_txt = my_narr;
search_txt = search_txtbx << get text;
if (search_txt != "",
prefix_txt = "";
suffix_txt = "";
highlight_txt = regex(my_narr, search_txt, prefix_txt || search_txt || suffix_txt, IGNORECASE, GLOBALREPLACE);
);
new window("Highlighted Narrative",
tb = textbox(highlight_txt, << markup),
tb << set width(700)
);
);
search_win = new window("Highlight Narrative Word",
vlistbox(
hlistbox(
textbox("Enter search term: "),
search_txtbx = texteditbox("", << set width(100))
),
buttonbox("OK", highlight_txt_expr;)
)
);
Re: Highlight selected portions of text in table cell?Nice!
Re: Highlight selected portions of text in table cell?Hey that's pretty cool. I think I can take that idea and run with it. Thanks MS!
Re: Highlight selected portions of text in table cell?The only idea I can come up with is to "cheat" using the new expression data type that came with JMP 12. It's probably not terribly useful, but it was fun to try.
//Example table
dt = New Table("test",
Add Rows(4),
New Column("Text",
Character,
"Nominal",
Set Values(
{"Highlight red, not green.", "The red-eyed bull raged about the red cape",
"Green and red Apples", "Ida Red Likes The Boogie"}
)
)
);
//Add column with highlighted "text""
dt << New Column("Red", Expression, <<Set Display Width(:Text << Get Display Width));
hwords = {"red", "Red"};
For Each Row(
w = Words(:Text, " .,-");
hpos = [];
For(i = 1, i <= N Items(hwords), i++,
hpos |/= Loc(w, hwords[i])
);
nw = New Window("test", wlb = Wrap List Box());
For(i = 1, i <= N Items(w), i++,
wlb << append(Text Box(w[i] || " "))
);
For(i = 1, i <= N Row(hpos), i++,
wlb[hpos[i]] << Font Color("Red")
);
:red = nw << get picture;
nw << closewindow;
);
Wait(1); :Text << Hide; // Just to complete the illusion...