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

Incrementing in the formula using string 1

Status
Not open for further replies.

crystaldev1

Programmer
Nov 6, 2003
232
US
Hello. I'm using CR 9 and Sql Server 2005.

I have this formula:

if (instr(TotalItem,Item) > 0) then ""
else TotalItem := TotalItem + Item;

I would like to add increment formula to the else condition as below:

if (instr(TotalItem,Item) > 0) then ""
else TotalItem := TotalItem + Item and X:=X+1;

Please let me know if there's a workaround for this. Thanks.
 
Just repeat in same formula, however you can not mix strings and numbers in an if..then..else

@EvalVars
whileprintingrecords;
global stringvar TotalItem;
global numbervar X;

if (instr(TotalItem,{Item}) < 0) then
TotalItem := TotalItem + {Item};

if (instr(TotalItem,Item) < 0) then X:=X+1;


Ian
 
It could be done like this:

whileprintingrecords;
global stringvar TotalItem;
global numbervar X;

if (instr(TotalItem,{Item}) < 0) then (
TotalItem := TotalItem + {Item};
X:=X+1
);

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top