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!

array on report

Status
Not open for further replies.

rommeltm00

Programmer
Feb 16, 2006
56
PH
good day to all

i want to use array on the report, here it goes

Dime db[100,4]
Dime cr[100,4]

SET ENGINEBEHAVIOR 70
sele b.cvoucherno,b.ccode,sum(b.namount),c.cdescripti;
from cvdata b,account c;
where b.cvoucherno=vvoucherno and b.ccode = c.ccode and b.namount>0;
group by b.ccode;
orde by b.namount desc;
INTO array db

sele b.cvoucherno,b.ccode,sum(b.namount),c.cdescripti;
from cvdata b,account c;
where b.cvoucherno=vvoucherno and b.ccode = c.ccode and b.namount<0;
group by b.ccode;
orde by b.namount desc;
INTO array cr
SET ENGINEBEHAVIOR 90

then on my report detail band

db[array_ctr,4] db[array_ctr,3]
cr[array_ctr,4] cr[array_ctr,3]

it only display the first data on the array

db array hold 2 items
cr array hold 5 items

this will be the output

guards fees 5000.00 cash in bank 4000.00
item s 10.00 items b 10.00
item sc1 100.00
item sc2 100.00
item sc3 300.00

 
What is array_ctr?
Is that some variable?
If it is did you ever increment it in your report?

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
yes that is the variable that was intended to increment

value to store = 1
initial value = 0
reset value based on = report
calculation type = none
release after report = checked
 
ok lets make it more easier to understand

the question is

how can i print array element on report
 
Rommeltm00,

how can i print array element on report

You can print an array element just like any other variable. Create an expression in the report, and set it to the array element. Of course, the array has to be in scope when you run the report, just like any other variable.

However, I wonder if that's what you really want to do. To print a variable number of rows of data (which I think is what you want), it's much easier to use a cursor. Just change your SQL so that the result goes to a cursor rather than an array, and make that cursor the data source for the report.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
You didn't increase your variable.
Change this:
Code:
calculation type = none

to
Code:
calculation type = SUM

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
Arrays and their associated individual elements are 'seen' like memory variables and each element has a single value.
Arrays are not a fully interchangeable substitute for a data cursor/table nor are they handled the same within VFP.

So within your REPORT FORM your
db[array_ctr,4] db[array_ctr,3]
are seen as merely 2 individual memory variables defined by the single current value of Array_Ctr at the time the REPORT FORM command is issued -- not ALL values of array DB.

As Mike Lewis has said above, instead of an array, put the data into a Cursor/Table and pass it to the REPORT FORM. That way, the REPORT FORM 'knows' to auto-increment the record pointer and print ALL values.

If this data needs to be in a relation to other report data, I'd recommend setting it up as a 'reverse' relation so that all Child records can be 'seen' by the REPORT FORM for each individual Parent record.

Good Luck,
JRB-Bldr
 
thank you guys for the time, ill try it using cursor, God bless and more power
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top