Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Force report to preview/print when NO DATA
Message
 
 
À
01/06/2004 22:04:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00908850
Message ID:
00919943
Vues:
11
Jim -- you already know this but... JIC, Dragan has it exactly right:

The behavior makes sense because REPORT FORM is a scoped command. If there is no scope it simply does not run.

Since you wanted to know how you could improve this behavior in VFP 9... I'll take a crack at a simple example here.

It's basically no different than what you might have done earlier. The real difference is, because this is object-assisted reporting, you get a chance to encapsulate and re-use the behavior from report to report, in a style similar to what you would do in other parts of VFP. That's why I'm writing the example, actually; I hope it makes this idea a bit more concrete.
CREATE CURSOR x (onefield l)

CREATE report simplenodata from x 
SELECT x

REPORT FORM simplenodata OBJECT ;
 (NEWOBJECT("reportListenerEvenIfNoData")) ;
 PREVIEW

DEFINE CLASS reportListenerEvenIfNoData ;
   AS ReportListener

  drivingAlias = ""
  tempAlias = ""
  
  PROCEDURE LoadReport()
     IF THIS.CommandClauses.Preview
        THIS.ListenerType = 1
     ELSE
        * you decide what you want for
        * various clauses...
        * you could also do this by
        * creating the object reference before
        * the REPORT FORM command of course
     ENDIF

     THIS.drivingAlias = ALIAS()     

     IF RECCOUNT() = 0 
        WAIT WINDOW ;
        "Report proxy cursor..."  NOWAIT
        THIS.tempAlias = "A" + SYS(2015)
        SELECT * FROM (THIS.drivingAlias) ;
          INTO CURSOR (THIS.tempAlias) READWRITE
        SELECT (THIS.tempAlias)
        APPEND BLANK
     ENDIF

  ENDPROC
    
  PROCEDURE UnloadReport()
     IF NOT ALIAS() == THIS.drivingAlias
        SELECT (THIS.drivingAlias)
        USE IN (THIS.tempAlias)
     ENDIF
  ENDPROC
     

ENDDEFINE
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform