Print Page | Close Window

Formula to look at a certain digit in text

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22578
Printed Date: 01 May 2024 at 6:41am


Topic: Formula to look at a certain digit in text
Posted By: Beso90
Subject: Formula to look at a certain digit in text
Date Posted: 17 Apr 2018 at 5:19am
Hello,

I'm building location labels and would like a formula to place an arrow pointing up or down based on the second segment of the location number.


locations are formatted like: A5-01-01
the second segment of that text defies the rack level, they are 01, 02, or 03.

I want it something along these lines:
if second segment is 01 then down else up



Thank you,
Bas



Replies:
Posted By: hilfy
Date Posted: 18 Apr 2018 at 5:51am
If the location will always be formatted with "-" between the sections, try something like this:

NumberVar at = inStr({MyTable.Location}, '-');
if at > 0 then
if mid({MyTable.Location}, at + 1, 2) = '01' then
    chr(226)
else chr(225)


When you put this formula on your report, change the font to WingDings and you'll get the appropriate up or down arrow.

-Dell

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window