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

Variables accounting for 0 values.

Status
Not open for further replies.

giggles7840

IS-IT--Management
Mar 8, 2002
219
US
win XP
CRXIR2SP2

i have this formula and it has been working fine.
whileprintingrecords;
stringvar array x := [totext({@00 Date}),totext({@01 Date}),totext({@02 Date}),
totext({@2A Date}),totext({@03 Date}),totext({@3A Date}),totext({@04 Date}),
totext({@05 Date}),totext({@06 Date}),totext({@07 Date}),totext({@08 Date}),
totext({@09 Date}),totext({@10 Date}),totext({@11 Date}),totext({@12 Date})];

stringvar array y;
numbervar cnt := 0;
numbervar i := 0;

for i := 1 to ubound(x) do(
if x <> "" then
(
cnt := cnt + 1;
redim preserve y[cnt];
y[cnt] := x));
y[cnt]

The new problem is the values in x are all null on a particular record which gives the cnt = 0. How and where do I account for records within the above code where all of the records are null so that the formula doesnt crash on me. I know i have done this before but it was quite a while ago and now I dont remember. It seems like it should be something like: If cnt = "" then 'No value" ?
 
You could try changing this part of the formula to:

for i := 1 to ubound(x) do(
if x <> "" then
(
cnt := cnt + 1;
if cnt <> 0 then (
redim preserve y[cnt];
y[cnt] := x)));
if cnt = 0 then
"" else
y[cnt]

I can't really test this.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top