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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

showing field names in a string if value is true

Status
Not open for further replies.

adnil

Technical User
Oct 29, 2003
50
GB
Hi,

I have some fields (in the same table) with a True/False value and I need to get the field names appearing in a string only if their value is True, ie:

ABC True
DEF
HIJ False
XYZ True

I need the above to appear in the report as: ABC, XYZ.

How can I get this done please? We are on CR XI

Thank you.

 
set up a formula for each field like:

@tst_abc
if {table.abc} = True
then 'ABC '
else ''

then have a formula that puts them all together:
@tst_all
{@tst_abc} & {@tst_def} & {@tst_ghi} . . .
 
Hi Charliy

Thank you for your advise.

I have tried and if only 1 of the fields is True, then @tst_all works fine. However, if 2 or more fields are True, @tst_all becomes blank.

Thank you.
 
Hi Charliy

I have sorted this now.

I created formula for each field as per your advise and I used the following to pull them together:

stringvar x:="";

if not isnull({@tst_abc}) then x:=x+{@tst_abc}&', ';
if not isnull({@tst_def}) then x:=x+{@tst_def}&', ';
if not isnull({@tst_hij}) then x:=x+{@tst_hij}&', ';
if not isnull({@tst_xyz}) then x:=x+{@tst_xyz}&', ';

x

Thank you for your assistance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top