Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reporting on values within an array
Message
 
To
04/06/2001 01:44:35
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00514419
Message ID:
00515056
Views:
16
Fred,

>>I don't want to say REPORT FORM report1 FOR dependent.classification = ARRAY(1,1) or ARRAY(2,1) or ARRAY(3,1)
20 times. It would be simplest if there were a REPORT FORM option to see if a field value matched any of the entries
in an array, but I don't see that as an option.

>>I would like to do this as cleanly as possible, without creating a cursor table if possible. However, I'll go with whatever
works best.


A couple of options:

1) Build up a REPORT FORM ... FOR INLIST() command and execute it with a macro expansion.
m.lcSQL = "REPORT FORM report1 FOR INLIST(Dependent.Classification"

FOR m.i = 1 TO ALEN(array, 1)
  m.lcSQL = m.lcSQL + ", array[" + ALLTRIM(STR(m.i) + "]"
NEXT

m.lcSQL = m.lcSQL + ")"

&lcSQL
2) Do a SQL query against your table and a cursor. The cursor is created from the array:
CREATE CURSOR SQLCls (Classification C(25)
APPEND FROM ARRAY laArray

SELECT * ;
  FROM myTable ;
  WHERE Classification IN ;
    (SELECT Classification ;
      FROM SQLCls) ;
  INTO CURSOR RptFinal

USE IN SQLCls

REPORT FORM report1

USE IN RptFinal
Of the two, I prefer the second option... it gives me more flexibility if I need to change/add stuff to the report cursor.

Regards,
Thom C.
Previous
Reply
Map
View

Click here to load this message in the networking platform