Hi All,
Is this a bug?
I have an application for a motel reservation system. I am trying to build a matrix array of Units/Dates to be used for the purpose of a dyanmic list box showing what units have been booked. My problem is that after I have filled the Array the first element has the same value throughout. If you run the following code you will see what I mean
****** START *****
trace.clear()
sUnits = "Unit1,Unit2,Unit3,Unit4,Unit5,Unit6,Unit7,Unit8,Unit9,Unit10"
sUnits=stritran(sUnits,",",crlf())
dim aUnits[10] as C
dim aMatrix[10,31] as P
aUnits.initialize(sUnits)
dDate = {01-07-2005}
for i = 1 to 10
for j = 1 to 31
aMatrix[i,j].Date = dDate + j -1
aMatrix[i,j].Unit = aUnits[i]
next j
next i
for j = 1 to 30
trace.writeln (cdate(aMatrix[1,j].date)+ "/" + aMatrix[1,j].Unit + " " + \
cdate(aMatrix[2,j].date) + "/" + aMatrix[2,j].Unit)
next j
***** END *****
The results displayed in the trace window are as follows (first 8 days only)
20050731/Unit1 20050701/Unit2
20050731/Unit1 20050702/Unit2
20050731/Unit1 20050703/Unit2
20050731/Unit1 20050704/Unit2
20050731/Unit1 20050705/Unit2
20050731/Unit1 20050706/Unit2
20050731/Unit1 20050707/Unit2
20050731/Unit1 20050708/Unit2
Notice how for Unit 1 the Dates are all the same
Any Suggestions?
Is this a bug?
I have an application for a motel reservation system. I am trying to build a matrix array of Units/Dates to be used for the purpose of a dyanmic list box showing what units have been booked. My problem is that after I have filled the Array the first element has the same value throughout. If you run the following code you will see what I mean
****** START *****
trace.clear()
sUnits = "Unit1,Unit2,Unit3,Unit4,Unit5,Unit6,Unit7,Unit8,Unit9,Unit10"
sUnits=stritran(sUnits,",",crlf())
dim aUnits[10] as C
dim aMatrix[10,31] as P
aUnits.initialize(sUnits)
dDate = {01-07-2005}
for i = 1 to 10
for j = 1 to 31
aMatrix[i,j].Date = dDate + j -1
aMatrix[i,j].Unit = aUnits[i]
next j
next i
for j = 1 to 30
trace.writeln (cdate(aMatrix[1,j].date)+ "/" + aMatrix[1,j].Unit + " " + \
cdate(aMatrix[2,j].date) + "/" + aMatrix[2,j].Unit)
next j
***** END *****
The results displayed in the trace window are as follows (first 8 days only)
20050731/Unit1 20050701/Unit2
20050731/Unit1 20050702/Unit2
20050731/Unit1 20050703/Unit2
20050731/Unit1 20050704/Unit2
20050731/Unit1 20050705/Unit2
20050731/Unit1 20050706/Unit2
20050731/Unit1 20050707/Unit2
20050731/Unit1 20050708/Unit2
Notice how for Unit 1 the Dates are all the same
Any Suggestions?
Comment