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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InStr and Mid 1

Status
Not open for further replies.

GCL2007

IS-IT--Management
Dec 11, 2007
167
US
I am trying to figure out someone else's report that I inherited... Can someone explain to me what this formula is doing?

IF InStr({OD.COMMENT1},"*",1) <= 1
THEN ' '
else
MID({OD.COMMENT1},INSTR({OD.COMMENT1},'*')+1,999)

In the first line I get that it is searching for a * in the field. Is it saying if it finds 0 or 1 occurrences to print ' '

on the bottom statement, what is the MID,INSTR, +1, 999 all about?

Thanks!!
 
Looked this up in the Help section of CR.

The optional "1" in the last position of the instr function allows the search to be case insensitive. If you use 0 or omit a number in the last position, the search will be case sensitive.

For the mid function, the 999 is an optional number which tells it to return up to 999 characters starting with the indicated start position ("*"+1). The instr function in the middle of the function says where the new string should start (1 character after the numeric position of "*"). If you omit the 999, the mid function should return the entire text following the start position.

Check the help section--it is actually very helpful.

-LB
 
GCL2007

You have posted 2 questions in the last 10 days and have received 2 answers, yet you have not even bothered to acknowledge those responses or indicated if they helped.

I suggest that you at least thank those who make the effort to assist you, and perhaps even give them a purple star if the suggestions answered your question. As well as showing your appreciation it also indicates to others searching the threads that the solution provided was helpful.


Pete.
 
Thanks Pete, You are absolutely right.. Thanks Lbass (as always, you have saved me a few times in the past).. With the holidays I really haven't been able to dig into lbass's notes in detail but definitely will..
 
Thanks LB... Makes sense now...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top