PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → printing array of items Iteratively
printing array of items Iteratively
Iniciado por guest, 14,ene. 2016 14:44 - 4 respuestas
Publicado el 14,enero 2016 - 14:44
Hi,
I am trying to print an array of items in Report..So I create a report with data source as the array..For a particular customer, all the transactions will be loaded in the array, after some calculation process and it needs to be printed in the table of the report (whose source is array)and their sum also..Then the array refreshed for the next customer and this is to be printed just below the first..ie a type of nested report using array refresh..

I tried following code

For each xxxx where xxxxxxxxx
.................
.................
For each yyyy where yyyyyyy
addline(Arrayname,[item1,item2,item3.....])
End

For each x of Arrayname
ipreview(i100)
iprintreport(Rpt, Arrayname)
End

Arraydelete(Arrayname)
................
..............
End

This gives me result like printing reports one after another...ie first customer printed first ..after closing it second one started...

What I want is all those to be printed one below another in a single report
Publicado el 14,enero 2016 - 14:47
Hi Amal,

Your data loop must be in the report in that case. This is a programmed data source. Load your array with all the desired customers, then loop this data in your report. Everything should be done in the report itself.

You must call only once the iPreview(). The way it is actually, you print one report per customer.

Best regards,
Alexandre Leclerc
Publicado el 14,enero 2016 - 17:04
Hi Amal,

If you add the ClientID in the array structure, you can have a single report.
Just set a break on ClientID and check the PageBreak after printing the break section.

Regards,
Piet
Publicado el 17,enero 2016 - 05:27
Hi Piet &Alexandre,

Thanks for your suggestions,,I have worked with break several times for other reports and it comes out well..but in this case I need to perform some calculations and add some new rows of data for each customer so that I filled that particular customer data only in that array...If I load the array with entire customer details and then break it won't give the desired output..

What I want is, fill some data in array print it ,print some other related details after dat,...then again fill array and print it just below the first and so on ..
Publicado el 18,enero 2016 - 14:39
Hi Amal,

We do that constantly. But we make it the easy way. We use a programmed data source (i.e. we tell the report when we are done). Then we print a record, we check if we have more data, we print it, etc. All the data munching is in the report itself, not from an external calculus.

Said otherwise, the "array" is computed in the report on the fly. The only parameter the report receives is the list of ID that it has to work with.

Then in the report we can generate as many details, sub-details, page break, etc. as we want.

You should be able to figure it out, I'm sure. If you must absolutely use an array and do not want logic in the report, use classes to nest details as required then send an array of classes. THis is a lot of coding for not much advantages, but will do it too.

Best regards,
Alexandre Leclerc