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!

Converting IF IN statement from Crystal to MSRS

Status
Not open for further replies.

beebass

MIS
Feb 19, 2007
14
DE
Hi there

I'm in the middle of converting crystal reports across to MSRS. One particular report has a formula field that looks for a particular string of characters in a field and returns an integar based on that if it finds it or not. I was wondering if this is possible of MSRS. At present the Crystal report formula is:

if " 1m" in {field.reference} then "1"
else
if " 4w" in {field.reference} then "1"
else
if " 2m" in {field.reference} then "2"...........

Any ideas how this if statement could be translated to MSRS.

Thanks
 
You may use the INSTR function in SSRS:

=iif(instr(Fields!FieldName.Value," 1m")<>0, "1", iif(instr(Fields!FieldName.Value," 4w")<>0, "1", iif(

Not tried it in the expression builder but certainly works in the code builder so you could build a little custom function and call it e.g.

=code.MyTransform(Fields!Fieldname.Value)

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top