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

declaring variable and concatinating two or more fields

Status
Not open for further replies.

ABetha

Programmer
Jul 14, 2010
35
0
0
US
I have 6 fields that I want to contacinate if they are not null or empty. This is what I started off with. I am getting an error
A string is required. Any help would be appreciated

stringvar notes;
notes = {qt_head.text_id_2};
if (not isnull({qt_head.text_id_3})) then
notes = {qt_head.text_id_2} + {qt_head.text_id_3};

else if (not(isnull({qt_head.text_id_4}) or {qt_head.text_id_4} = " " then
notes = {qt_head.text_id_2} + {qt_head.text_id_3} + {qt_head.text_id_4};
else
if (not isnull({qt_head.text_id_5}))or {qt_head.text_id_5} = " " then
notes = {qt_head.text_id_2} + {qt_head.text_id_3} + {qt_head.text_id_4} + {qt_head.text_id_5};
else
if (not isnull({qt_head.text_id_6})) or {qt_head.text_id_6} = " " then
notes = {qt_head.text_id_2} + {qt_head.text_id_3} + {qt_head.text_id_4} + {qt_head.text_id_5} +{qt_head.text_id_6};
else
if not IsNull ({qt_head.text_id_7}) or {qt_head.text_id_7} = " " then
notes = {qt_head.text_id_2} + {qt_head.text_id_3} + {qt_head.text_id_4} + {qt_head.text_id_5} + {qt_head.text_id_6} + {qt_head.text_id_7}
 
You don't really need to use a variable for this, but if you do, you need to use a colon in all places, as in:

notes :=

You would then end the formulas with a semicolon and then reference the variable, as in:

;
notes

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top