Print Page | Close Window

If then formula

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=11448
Printed Date: 04 May 2025 at 1:43pm


Topic: If then formula
Posted By: stevetothink
Subject: If then formula
Date Posted: 18 Oct 2010 at 8:57am
Hi Folks,
 
I have a database field such as PA12345 and I want to write an if then formula that says "if the first 2 letters of this field equal "PA" then display $21.12."
 
Is it possible to have the formula only look at the first 2 letters of the data for an if/then statement?

Thanks in advance.
 
Steve



Replies:
Posted By: rybad80
Date Posted: 19 Oct 2010 at 5:59am
You can use the  startswith command.
 
If {table.database} startswith "PA"
Then "$21.12"



Print Page | Close Window