Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string length is less than 0 or not an integer

Status
Not open for further replies.

nuttyernurse

Technical User
May 18, 2009
35
US
I am trying to get specific text from a string that works until I get a null field.

The string is:
<SPAN STYLE=""font-family:Arial; font-size: 3pt""><FONT FACE=""Arial"" SIZE=""3""> <STRONG><I><U>Presenting complaint:</U></I></STRONG> EMS states: shortness of breath, worse this pm, just released from regency earlier today</FONT></SPAN>

I only want:
EMS states: shortness of breath, worse this pm, just released from regency earlier today

And I get it except when this field is null. The formula I am using is:
Mid({EDMS_ARC.s_Entry},InStr ({EDMS_ARC.s_Entry},"</STRONG>")+9,(InStr ({EDMS_ARC.s_Entry},"</FONT>" ))-(InStr ({EDMS_ARC.s_Entry},"</STRONG>" )+9))

How do I deal with the null fields?

Thank you in advance!
 
Hi,
Did you try:
Code:
If NOT IsNull({EDMS_ARC.s_Entry}) 
then 
Mid({EDMS_ARC.s_Entry},InStr ({EDMS_ARC.s_Entry},"</STRONG>")+9,(InStr ({EDMS_ARC.s_Entry},"</FONT>" ))-(InStr ({EDMS_ARC.s_Entry},"</STRONG>" )+9))
else
"No Data in Field" [COLOR=green]// ( or anything you want including "")[/color]


[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thank you Turkbear for the quick reply!

I tried it and it wont run the report, takes me right back to formula editor, and "string length is less than 0 or not an integer" error.
 
Hi,
Where does the error show up ( which line seems to cause it?)
Maybe try:
Code:
If ( 
IsNull({EDMS_ARC.s_Entry}) Or Trim({EDMS_ARC.s_Entry}) = ""
)
then 
"No s_Entry data" 
else
Mid({EDMS_ARC.s_Entry},InStr ({EDMS_ARC.s_Entry},"</STRONG>")+9,(InStr ({EDMS_ARC.s_Entry},"</FONT>" ))-(InStr ({EDMS_ARC.s_Entry},"</STRONG>" )+9))

If still getting that error, try placing each part of your string slicing formula as a separate formula in the page footer and see if they do what you expect:

@Part1
Mid({EDMS_ARC.s_Entry},(Instr(({EDMS_ARC.s_Entry},"</STRONG>")+9)
@Part2
(InStr ({EDMS_ARC.s_Entry},"</FONT>" ))-(InStr ({EDMS_ARC.s_Entry},"</STRONG>" )+9))





[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Turkbear this is what happened:

When I placed the formula in the footer, I returns the correct answer but only one time. I split the formula as suggested and @Part1 returned a text value (close to what I want), @Part2 returned a numeric value equal to the number of characters of text I want to display.

This is a canned report that I am trying to modify to meet my needs more accurately.

 
Hi,
OK..Seems correct so far...Try moving the formula (@Part1 )to the details and see when it fails to work ( if it does)..Add the @Part2 and watch the count to see if it hits 0 on some record.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Yes there are several "0.00" fields, has to do with one specific field, "PMD" that is sometimes blank. I also have found the format of the data is not the same in all fields. Here are the three different formats:

"<SPAN STYLE=""font-family:Arial; font-size: 3pt""><FONT FACE=""Arial"" SIZE=""3""> <STRONG><I><U>Presenting complaint:</U></I></STRONG> Child states: Slurred speech since about 9am</FONT></SPAN>"

"<SPAN STYLE=""font-family:Arial; font-size: 3pt""><FONT FACE=""Arial"" SIZE=""3""> Foley cath inserted 16 Fr. Balloon inflated. To gravity drainage. other by rn using sterile technique</FONT></SPAN>"

"<SPAN STYLE=""font-family:Arial; font-size: 3pt""><FONT FACE=""Arial"" SIZE=""3""> The patient has <STRONG><I><U>not recently seen a physician,</U></I></STRONG> and does not have an established primary care provider,</FONT></SPAN>"

They are all in the same report.
 
Hi,
Looks like you need to test for the presence of the <STRONG></STRONG> tags and change your extraction formula accordingly, something like:
Code:
If ( 
IsNull({EDMS_ARC.s_Entry}) Or Trim({EDMS_ARC.s_Entry}) = ""
)
then 
"No Data for s_Entry"
Else
  If Instr({EDMS_ARC.s_Entry},"<STRONG>") > 0 
  Then
   Mid({EDMS_ARC.s_Entry},InStr ({EDMS_ARC.s_Entry},"</STRONG>")+9,(InStr ({EDMS_ARC.s_Entry},"</FONT>" ))-(InStr ({EDMS_ARC.s_Entry},"</STRONG>" )+9))

 Else
   Mid({EDMS_ARC.s_Entry},(
    InStr("SIZE=") + 8),InString("<FONT")-
     InStr("SIZE=") + 8) )

Some tweeking of this should work, depending on the data variations.

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Turkbear,

Works great! But then I go to the next page and the integer issue pops up again, only when I click the arrow to the next page! Otherwise flawless!!!
 
hi nuttyernurse...
if you keep getting that error try this approach .. a little different..


//formula
numbervar a;
numbervar b := len({EDMS_ARC.s_Entry});
stringvar c;
booleanvar flag := true;
if isnull({EDMS_ARC.s_Entry}) = false then
for a := 1 to b Do
(
if mid({EDMS_ARC.s_Entry},a,1) = "<" then
flag := false;
if flag = true then c := c & mid({EDMS_ARC.s_Entry},a,1);
if mid({EDMS_ARC.s_Entry},a,1) = ">" then
flag := true;

);
c



_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
I think you might need to test for the presence of all of the codes you are using in your formula--font and size, too.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top