%iFind SQL Search strips cr/lf from returned "Highlighted" text

Primary tabs

iFind, iKnow

Hi-

I have a SQL Query using %iFind.Highlight which returns text highlighting certain words and phrases.   %iFind.Highlight seems to remove cr/lf from the returned text.

Here's my query

ClassMethod Search(pSessionId As %String, pSearchString As %String) As %String
{
    set tTags="<span style='background-color:yellow;'>"
    &sql(
    SELECT %iFind.Highlight(Text , :pSearchString , , :tTags) into :results 
    FROM SSA_OCR.TempSearchable where sessionId = :pSessionId)
    quit results
}

The returned text looks like this:

Record date: 2075-01-07 NAME: Villegas, Yosef MRN: 8249813 S: Here for follow up of his colonic polyps. He wants to know the results from them. He is not taking hydrochlorothiazide and is curious about his blood pressure. He said he has cut his alcohol back to 6 pack once a week. He has cut back his cigarettes to one time per week. He does say he has had some problems with his memory recently, although no other manifestations of dementia and no difficulty with ADLs. He says he uses Viagra occasionally and it works for him. O: Well-appearing male. Blood pressure 142/74. Chest clear. COR: No murmur. A: (1) Alcohol excess discussed. | told him to cut it out entirely. (2) Cigarette smoking. Discussed. (3) Hypertension. Under good control. (4) Elevated lipids. Will check FLP. (5) Worried about dementia. Will check B12, TSH, RPR for now. (6) Status-post knee replacement. Gets occasional Vicodin from his orthopedist. Says he wanted 8 Percocet for the next month or two that he will take on rare occasions when his pain is more severe, and | did give him 8 Percocet. P: Follow up with Dr. Hobbs in 3 months. Gilbert P. Perez, M.D. GPP/church /olinger  

 

It removed all of the cr/lf formatting from the original text and just returns along string (unformatted)

Is there any way to have it leave the cr/lf formatting in the returned highlighted text?

 

 


 

Replies

Looks like this is not possible by default:

You can use this trivial workaround:

set nl = $c(13,10)
set replace = "*"
set search = "MRN"
&sql(DECLARE C1 CURSOR FOR
     SELECT REPLACE(%iFind.Highlight(REPLACE(Text, :nl, :replace),:search), :replace, :nl) ...

And as long as your text does not contain replace sequence it should work.