Print Page | Close Window

"This" Field

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=20424
Printed Date: 02 May 2025 at 10:16am


Topic: "This" Field
Posted By: patton77
Subject: "This" Field
Date Posted: 04 Feb 2014 at 11:39am
Hi all

My apologies if this is a stupid question, I cant find a answer for this one...I am not a programmer so go easy on me....

Is there anyway I can get a field to reference itself without having to refer to the actual field name in the formula.

I have a bunch of fields I need to write basic script for and change the field name, but if I could get the field name to reference itself, I could just write the one script and it could apply to all fields.

for example my code for the myfield1 field is

If {mytable.myfield1}=5 then crGreen else
If {mytable.myfield1}=1 then crRed
else crwhite

and myfield2

If {mytable.myfield2}=5 then crGreen else
If {mytable.myfield2}=1 then crRed
else crwhite

however, I would prefer

If {mytable.thisfield}=5 then crGreen else
If {mytable.thisfield}=1 then crRed
else crwhite

That way the one script is applied to all fields.

Hope someone can help




Replies:
Posted By: DBlank
Date Posted: 04 Feb 2014 at 12:09pm
currentfieldvalue


Posted By: DBlank
Date Posted: 04 Feb 2014 at 12:10pm
write it on one and paint it onto the other fields


Posted By: patton77
Date Posted: 04 Feb 2014 at 2:46pm
thank you very much !



Print Page | Close Window