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

formula for fields characters

Status
Not open for further replies.

Dukester0122

IS-IT--Management
Mar 18, 2003
587
US
I'm creating a formula that would take the second word which is the item nbr in the statement. Here's an example of the statement - The Item001 was created in the system.

Please note that the word can be from 4-15 characters.
 
Hi,
You failed to ask a question, but , assumoing you want to know how to do that:

Try creating a formula something like:

@SecondWord
StringVar array x
StringVar SecondWord;
x := Split({table.statementfield},' ')
SecondWord := x(2);






[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
I was going to suggest something like var(right({field})), but var does not seem to be recognised in my v9 installation. I could have sworn this was a recognised Crystal function. Yet, in v9 it seems to have been removed. What's up with that? Am I mixing my applications up or something?
 
Hi,
In CR10:

Var
Crystal OLAP Syntax.
Returns the unbiased variance (variance normalized to n-1) of a numeric expression evaluated over a set.

Don't know about v9 since I moved from 8.5 to 10 ( 9 was too buggy to try).

The Right(string,x) would probably not help, since the string to be extracted can vary in length..





[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Adding some finishing touches to Turkbear's solution, which should work fine:

StringVar array x;
StringVar SecondWord;
x := Split({table.statement}," ");
SecondWord := x[2];

-LB

 
Right. I just asked because entering VAR in CR9 and qualifying it with proper arguments returns an error, because the function is unrecognised.

Regarding string length, it doesn't matter, as Var stops when it hits an alpha character. i.e. ("Item001", and "ItemNumber2") both return 001 and 2 respectively.

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top