Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HTML report using tables of the application
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows NT
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01416262
Message ID:
01416421
Vues:
68
Aside from the fact that I hate using any data environments, is the report itself being generated through your report listener. If that is, but it fails subsequent, then I would suspect the tables are not open during your upcoming query with the INNER JOINs. I would be explicit in those queries to have a path reference to your data. Don't let VFP guess where your files are, and if they are not where you expect, then it SHOULD crash until its properly refereneced / resolved.

something like

I am using "alias" references instead of re-copying full table name
lcMyDataPath = "C:\MyApp\MyData\"

select  C.Linkha_pfk, C.d4pednr, C.fornecs_id....,;
           PE.DataCompra, PE.HoraCompra, PE. .....,;
           F.Fisicjurid, F.contato, F.endereco, .... ;
   from ( lcMyDataPath + "Copedite" ) C;
        inner join ( lcMyDataPath + "Pedcompr" ) PE;
           on C.D4pednr = PE.compra_id;
        inner join ( lcMyDataPath + "Produtos" )  PR;
           on C.D4prodt = PR.Referencia;
        inner join ( lcMyDataPath + "Fornecs" ) F;
           on C.Fornecs_id = F.Fornec_ID;
  order by ...
  into ...
Additionally, you are expecting some tables to be open and to select them, what if they were not available through some other reason.
If  pcalias="pedcompr"
   if not used( "Copedite" )
       use ( lcMyDataPath + "Copedite" ) in 0
   endif 

   Select copedite
Endif
HTH



> Fornecs.fisicjurid, Fornecs.contato, Fornecs.endereco, Fornecs.bairro,;
> Fornecs.cidade, Fornecs.estado, Fornecs.cep, Fornecs.ddd, Fornecs.telefone,;
> Fornecs.email;
> FROM ;
> copedite ;
> INNER Join Pedcompr ;
> ON copedite.d4pednr = Pedcompr.compra_id ;
> INNER Join Produtos ;
> ON copedite.d4prodt = Produtos.referencia ;
> INNER Join Fornecs ;
> ON copedite.fornecs_id = Fornecs.fornec_id;
> ORDER By copedite.d4pednr, Produtos.descricao;
> INTO Cursor cur_pesquisa1





>Hi... this is the second thread that I open with same subject and problem. I still trying to make a report of mine work under this circunstance: "To open some table and set a environment... and so... run a report using this set of tables."
>
>Maybe I already try all possibles possibilities.. And I decide to open this thread as a kind of last thing to do...
>
>This one works inside VFP.... And not outside VFP, as a desktop application .EXE.. Maybe I'm facing a bug... But I don't know how to work around this...
>
>Ps: I tried... Recreate the report... Work with/without the tables inside the report's dataenvironment... The behavior is always the same.... An open dialog appears asking for a DBF file and nothing happend at all...
>
>Any Help will be appreciated
>
>
>Lparameters pntipo, pcalias, pcchave
>#Define DebugListener -2
>#Define PrintListener 0
>#Define PreviewListener 1
>#Define XMLListener 4
>#Define HTMLListener 5
>lclocal		= Justpath(_Screen.cNome_arq_prosi)
>_ReportOutput  = Forcepath("REPORTOUTPUT.APP", lclocal)
>_ReportPreview = Forcepath("REPORTPREVIEW.APP", lclocal)
>_ReportBuilder = Forcepath("REPORTBUILDER.APP", lclocal)
>If  File(lcdest)
>	Erase lcdest NORECYCLE
>Endif
>lcClasslibs                  = Set("Classlib")
>options 					 = " NOEJECT"
>If  Upper("reportlistener")$Upper(lcClasslibs)
>Else
>	If  Version(2)=2
>		Set Classlib To Home()+"\ffc\_reportlistener.vcx" Additive
>	Else
>		Set Classlib To "_reportlistener.vcx" Additive
>	Endif
>Endif
>Local oListener As Object
>Local oXH As Object
>Local loPreview As Object
>
>pcalias			= Substr(pcalias+Space(20),1,20)
>pcchave			= Substr(pcchave+Space(10),1,10)
>forexpr			= Iif(Empty(This.cForExpression),""," for "+This.cForExpression)
>
>If  pntipo=2
>	lcrepo		= Forcepath(Alltrim(commlog.Nome)+".frx", _Screen.clocalreports)
>	lcdest		= Forcepath(Forceext(Alltrim(commlog.Nome), "htm"),_Screen.clocalreports)
>	lcemail		= commlog.dest_email
>	lcdstnome	= commlog.dest_nome
>	lccdusuario = commlog.cdusuario
>Else
>	lcrepo		= Forcepath(Alltrim(cur_destinos.Nome)+".frx", _Screen.clocalreports)
>	lcdest		= Forcepath(Forceext(Alltrim(cur_destinos.Nome), "htm"),_Screen.clocalreports)
>	lcemail		= cur_destinos.email
>	lcdstnome	= cur_destinos.dest_nome
>	lccdusuario = cur_destinos.cdusuario
>Endif
>lcassi		= Forcepath("assinatura.htm", lclocal)
>
>lclib				 = "_reportlistener.vcx"
>If  Version(2)=2
>	lclib			 = Forcepath("_reportlistener.vcx",Home()+"\FFc\")
>Endif
>oHTMLReport = Newobject("HtmlListener", lclib)
>oHTMLReport.ListenerType = HTMLListener
>oHTMLReport.TargetFileName = lcdest
>
>*Setup HTML Listener as a successor
>DO (_REPORTOUTPUT) WITH oHTMLReport
>With oHTMLReport
>  .QuietMode    = .T.
>  .TargetFileName = (lcdest)
>  .TargetFileExt  = ("HTML")  &&"TXT", "LOG", "XML"
>EndWith
>
>If  pcalias="pedcompr"
>	Select copedite
>Endif
>If  "XTC002"$Upper(lcrepo)
>	Select copedite.linha_pfk, copedite.d4pednr, copedite.fornecs_id,;
>		copedite.cdusuario, copedite.d4prodt, copedite.d4qtfat, copedite.unid,;
>		copedite.unid2, copedite.d4qtpec, copedite.d4qtpec2, copedite.d4pruni,;
>		copedite.d4pruni2, copedite.d4prtot, copedite.d4qtok,;
>		Pedcompr.datacompra, Pedcompr.horacompra, Pedcompr.comprador,;
>		Pedcompr.pagamt_id, Pedcompr.valorcompr, Pedcompr.valordesco,;
>		Pedcompr.valortt, Produtos.referencia, Produtos.descricao,;
>		Produtos.resumida, Produtos.vendavelpr, Produtos.referencpr,;
>		Produtos.grupo, Fornecs.fornec_id, Fornecs.nmfantasia, Fornecs.razaosoc,;
>		Fornecs.fisicjurid, Fornecs.contato, Fornecs.endereco, Fornecs.bairro,;
>		Fornecs.cidade, Fornecs.estado, Fornecs.cep, Fornecs.ddd, Fornecs.telefone,;
>		Fornecs.email;
>		FROM ;
>		copedite ;
>		INNER Join Pedcompr ;
>		ON  copedite.d4pednr = Pedcompr.compra_id ;
>		INNER Join Produtos ;
>		ON  copedite.d4prodt = Produtos.referencia ;
>		INNER Join Fornecs ;
>		ON  copedite.fornecs_id = Fornecs.fornec_id;
>		ORDER By copedite.d4pednr, Produtos.descricao;
>		INTO Cursor cur_pesquisa1
>ENDIF
>If  Upper(_Screen.cLocaltabelas)$ Set("Path")
>Else
>	Set Path To (_Screen.cLocaltabelas) Additive
>ENDIF
>
>Report Form (lcrepo) ENVIRONMENT &forexpr TO Printer Prompt NOCONSOLE Object oHTMLReport
>*
>* I already try to take out &forexpr and ENVIRONMENT... Using preview clause the report works...
>* 
>IF  USED("cur_pesquisa1")
>	USE IN "cur_pesquisa1"
>endif
>
>_Cliptext=Message()
>oHTMLReport = ""
>If  File(lcdest)
>	If  File(lcassi)
>		lcstr			= Filetostr(lcdest)
>		lnmaiorpos		= Thisform.ver_maior_htmlpos(lcstr)
>		lcstrass		= Filetostr(lcassi)
>		lnpos2			= At("top:4.75417in", lcstrass)
>		If  lnpos2>0 And lnmaiorpos<> 0
>			lcstrass	= Stuff(lcstrass, lnpos2, 13, "top:"+Chrtran(Alltrim(Transform(lnmaiorpos,"9999.99999")), Set("point"), ".")+"in")
>			lcstrass	= Strconv(lcstrass,9)
>		Endif
>		lnpos			= At("</body></html>", lcstr)
>		If  lnpos>0
>			lcstr		= Stuff(lcstr, lnpos, 0, lcstrass)
>			=Strtofile(lcstr, lcdest, 0)
>		Endif
>	Endif
>	If  Thisform.doenvio_email(lcdest, Alltrim(lcemail), Alltrim(lcdstnome), Alltrim(lccdusuario))
>		If  pntipo=2
>			Select commlog
>			Scatter Memvar Memo
>			m.dtexec		= Datetime()
>			Gather Memvar Memo
>		Endif
>	Endif
>Endif
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform