James123
James123

Reputation: 11652

Combine text in formula field in crystal reports 2008

I have databasefields to check a condition and return multiline text. For example:

returnText = ''

 If TD1 = true then
      returnText = 'text1'
 If TD2 = true then
      returnText = returnText + \n' + 'text2'
 If TD3 = true then
      returnText = returnText + \n' + 'text3'
  return returnText

How can I do this with a formula field, or what is another way to do this?

Upvotes: 0

Views: 7538

Answers (1)

nidu
nidu

Reputation: 559

You can do it using formula. Not sure what syntax you use. It's closer to Basic, but here's a Crystal Syntax version:

local stringVar returnText = "";

if TD1 = true then
    returnText := "text1";
if TD2 = true then
    returnText := returnText + chr(13) + "text2";
If TD3 = true then
    returnText := returnText + chr(13) + "text3";
returnText

Or with Basic:

dim returnText as string
returnText = ""

if TD1 = true then
    returnText = "text1"
end if
if TD2 = true then
    returnText = returnText + chr(13) + "text2"
end if
If TD3 = true then
    returnText = returnText + chr(13) + "text3"
end if
formula = returnText

Upvotes: 1

Related Questions