Ario.Paxaz Posted August 18, 2018 Share Posted August 18, 2018 Hi I use Report Builder for preview my report. If the query don't answer the report file don't created in UniServerModule.NewCacheFileUrl folder . I checked every time, no files created. And I want to not open the preview form if it is not answered, and the message of ( Not Found ) is displayed. How should I do this? function TrepDataModule.GenRep(const InvN: string): string; var lPDFDevice: TppPDFDevice; begin InvNum := InvN; OpenDS(); lPDFDevice := TppPDFDevice.Create(nil); try lPDFDevice.PDFSettings := ppReport1.PDFSettings; lPDFDevice.FileName := UniServerModule.NewCacheFileUrl(False, 'pdf', '', '', Result, True); lPDFDevice.Publisher := ppReport1.Publisher; // generate the report ppReport1.PrintToDevices; finally lPDFDevice.Free; CloseDS; end; end; I Insert if Not(lPDFDevice.FileName<>'') then Begin Showmessage('Not Found...'); Exit End; But all of time message showed. Best Regards. Quote Link to comment Share on other sites More sharing options...
Wilton Ergon Posted August 18, 2018 Share Posted August 18, 2018 function TrepDataModule.GenRep(const InvN: string): string;varlPDFDevice: TppPDFDevice; AUrl,ArquivoSaida:string;begin AUrl :=''; ArquivoSaida := UniServerModule.NewCacheFileUrl(False, 'pdf', '', '', AUrl, True); InvNum := InvN;OpenDS();lPDFDevice := TppPDFDevice.Create(nil);trylPDFDevice.PDFSettings := ppReport1.PDFSettings;lPDFDevice.FileName := ArquivoSaida;lPDFDevice.Publisher := ppReport1.Publisher;// generate the reportppReport1.PrintToDevices;finallylPDFDevice.Free;CloseDS;end;end; use aUrl for show report in form with tunipdfframe Quote Link to comment Share on other sites More sharing options...
Ario.Paxaz Posted August 19, 2018 Author Share Posted August 19, 2018 Hi I use Demo function and don't have any problem.My problem is: If the query of related report is empty ,how to can you find out? And show message? Best Regards. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 19, 2018 Share Posted August 19, 2018 Hi, If I understand you correctly, simple use isEmpty function of your DataSet if not DataSet.isEmpty then begin // create report end else // not found Quote Link to comment Share on other sites More sharing options...
Ario.Paxaz Posted August 19, 2018 Author Share Posted August 19, 2018 Hi Each report has an internal query that has difficulty accessing its data, and the result is empty. I wanted to know if you could understand how to create it in the following directory before reporting it. (lPDFDevice.FileName := UniServerModule.NewCacheFileUrl(False, 'pdf', '', '', Result, True) How to understand If Report Builder do not create the file in the top folder I use this command if Not(lPDFDevice.FileName<>'') then But It don't work correctly. Best Regards. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.