Quantcast
Channel: Home of ActiveVFP - Foxpro on the World Wide Web
Viewing all 1109 articles
Browse latest View live

New Post: Accessing VFP database on the web

$
0
0
The program consists of 39,000 lines of code, 170 screens, and 52 reports.
Start simple with a Proof of Concept or prototype. Rarely does anyone with a Foxpro desktop application want to convert the entire legacy app over to the web or mobile. It would be a waste of time\effort\money and more than likely not take advantage of the medium.

If you start this way, building a simple web or mobile app from your VFP data\code, you can begin to see how it will work and maybe gain some confidence.

We, as consultants, can also help in the task should you need it.

New Post: Installing ActiveFVP in web root folder

$
0
0
I was wondering why it wasn't so easy to install or implement ActiveVFP in the web root or root url folder. After many hours of web searching and trying various forms of JUSTPATH(oProp.ScriptPath) combination I found it.

Wherever you have a href link tag, simple remove the '/' from the [oProp.Action] parameter. For example, <a href="<%=JUSTPATH(oProp.ScriptPath)+[/protectedlist]+oProp.Ext%>"> becomes:

<a href="<%=JUSTPATH(oProp.ScriptPath)+[protectedlist]+oProp.Ext%>">

New Post: Installing ActiveFVP in web root folder

New Post: Windows 2008 server R2 64 bit

$
0
0
After using ActiveFP successful for 5 year, I make a update on my server, and now I didn't find a way to put avfp to work again.

I set The dir for application and also set to run32 bit applications, the webconfig is <trust level="Full" />

but I still get error like

Erro de Servidor no Aplicativo '/fox'.

Falha na recuperação de fábrica de classes COM do componente com CLSID {BEF60CED-FB7C-4835-A927-4EC90F5162CB} devido ao seguinte erro: 80040154 Classe não registrada (Exceção de HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Descrição: Ocorreu uma exceção sem tratamento durante a execução da atual solicitação da Web. Examine o rastreamento de pilha para obter mais informações sobre o erro e onde foi originado no código.

Detalhes da Exceção: System.Runtime.InteropServices.COMException: Falha na recuperação de fábrica de classes COM do componente com CLSID {BEF60CED-FB7C-4835-A927-4EC90F5162CB} devido ao seguinte erro: 80040154 Classe não registrada (Exceção de HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Erro de Origem:

Exceção sem tratamento foi gerada durante a execução da atual solicitação da Web. As informações relacionadas à origem e ao local da exceção podem ser identificadas usando-se o rastreamento de pilha de exceção abaixo.

Rastreamento de Pilha:


[COMException (0x80040154): Falha na recuperação de fábrica de classes COM do componente com CLSID {BEF60CED-FB7C-4835-A927-4EC90F5162CB} devido ao seguinte erro: 80040154 Classe não registrada (Exceção de HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).]
AVFPHandler.ProcessRequest(HttpContext context) +58
AVFPHandler.OnInit(EventArgs e) +36
System.Web.UI.Control.InitRecursive(Control namingContainer) +140
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +480

Informações sobre a Versão: Microsoft .NET Framework Versão:4.0.30319; Versão do ASP.NET:4.0.30319.272

Aparently Afvp is not registred, how to register ?

New Post: Windows 2008 server R2 64 bit

$
0
0
I found a not so nice solution

regsvr32 activevfp.dll

Was suppose to be self registered, But don't " microst issue I guees"

Manually registered is working now, writing here to help others with similar problem

New Post: Problem with printing report

$
0
0
I need to send a frx report directly to my printer from AVFP. I've tried this code:
printerName = "35PPM PCL6"
cReport = oProp.AppStartPath + "reports\doc.frx"
SET PRINTER TO NAME (printerName)
REPORT FORM (cReport) TO PRINTER NOCONSOLE
Usually, in visual foxpro, this code works fine but in AVFP i receive this error code:
err#= 1001 line= 175 Feature is not available.
I don't understand where is the problem. The documentation says that i can use the set printer.
Any idea?

New Post: Problem with printing report

$
0
0
you can't do it directly from avfp since it's a vfp mtdll. But you can call a VFP EXE COM server from the avfp mtdll which can do it.

The following is an example using PDF (Victor has a routine that prints VFP reports from AVFP that goes to local printers without PDF - look here in discussions or ask him directly):
  • This is the routine the avfp demo runs
oPDF=CREATEOBJECT("pdfrun.print2pdf")
if isnull(oPDF)
  return .f.
endif
oPDF.cPSColorPrinter ="Xerox Phaser 6120 PS"
oUtil=NEWOBJECT('AVFPutilities')
* files older than 20 Minutes(1200 ms.), erase.  3rd param is path - can be hardcoded
oUtil.DeleteFiles('pdf',1200,oProp.AppStartPath+[Temp\])
lcCompany=oRequest.Form("Company")
IF ISNULL(lcCompany) .OR. EMPTY(lcCompany)
  oPDF.cRecordSelect = [SELECT * from ']+ oProp.DataPath+[customer' INTO CURSOR tcursor]
ELSE
  oPDF.cRecordSelect = [SELECT * from '] + oProp.DataPath+[customer' ]+;
 [WHERE UPPER(company)=ALLTRIM(UPPER(']+lcCompany+[')) INTO CURSOR tcursor]
ENDIF
* the following properties are coded for portability.  They may be hardcoded instead.
oPDF.cReport = oProp.AppStartPath+"reports\listcust.frx"
oPDF.cPhysicalPath=oProp.AppStartPath+[Temp\]     &&[C:\Program Files\dotComSolution\AVFPdemo2\Temp\]
oPDF.cLogicalPath=[http://]+oRequest.ServerVariables("HTTP_HOST") +JustPath(oRequest.ServerVariables("URL"))+[/Temp/] &&[http://www.ddddd.com/avfpdemo2/Temp/]
lcFile=oPDF.GetOutput() && generate output, return temp file name
lcNewPath=oPDF.cLogicalPath+lcFile && new URL
oResponse.Redirect(lcNewPath)  && redirect browser to created file
oPDF = .NULL.
release oPDF

New Post: Problem with printing report

$
0
0
claudefox wrote:
you can't do it directly from avfp since it's a vfp mtdll. But you can call a VFP EXE COM server from the avfp mtdll which can do it.

The following is an example using PDF (Victor has a routine that prints VFP reports from AVFP that goes to local printers without PDF - look here in discussions or ask him directly):
Ok, i understand! I already know and use pdfrun. Thanks for reply.

New Post: Problem with printing report

$
0
0
As claude said, you can't send a report directly from your AVFP code using REPORT FORM. Instead, you use a new helper class called avfpReportHelper that would be included in the next release of AVFP:
 TRY
    LOCAL oHelper
    oHelper = CREATEOBJECT("avfpHelpers.avfpReportHelper")
    oHelper.cPrinterName = "35PPM PCL6"
    oHelper.cReportFile = oProp.AppStartPath + "reports\doc.frx"
    oHelper.cDataSource = oProp.appStartPath + "temp\datafile.dbf"
    oHelper.lAutoDropDataSource = .T.   && Delete datasource file automatically after print
    oHelper.cReportOutput = oProp.appStartPath + "REPORTOUTPUT.APP"
    oResult = oHelper.Execute()

  CATCH TO ex
    * TODO: Log the error
  ENDTRY
To install the new helper:
  1. Download this file
  2. Extract the file
  3. Copy REPORTOUTPUT.APP in your AVFP's root folder
  4. Copy AVFPHELPERS.DLL y TLB in your AVFP's BIN folder
  5. Register AVFPHELPERS.DLL using regsvr32 (if you are in a 64bit system, use c:\windows\syswow64\regsrv32.exe)
Victor Espina

New Post: Problem with printing report

$
0
0
As you can see in the example, this first version of avfpReportHelper requires that the data to be printed has to be saved in a physical file. My goal for next version is add support for SQL statements as well for JSON data, to avoid the need of a temporary file.

Also, my idea is to add PDF support directly to the helper, so you can choose to send the report to a printer or to a PDF file.


Victor

New Post: Problem with printing report

$
0
0
Thank you Victor. I followed your steps but when i launch the webpage i haven't any error but the printer not receiving the file to print.
Printer name is correct and, if can be usefully, the printer is the windows default printer.

P.S. The file that i set as datasource is not empty.

New Post: Problem with printing report

$
0
0
Try to put some code in the CATCH section to log any error that can be arising. Or remove the TRY - CATCH block so AVFP can report the error back to your browser.

Victor Espina

New Post: Problem with printing report

$
0
0
vespina wrote:
Try to put some code in the CATCH section to log any error that can be arising. Or remove the TRY - CATCH block so AVFP can report the error back to your browser.

Victor Espina
I've this code:
    
    TRY
        LOCAL oHelper
        oHelper = CREATEOBJECT("avfpHelpers.avfpReportHelper")
        oHelper.cPrinterName = "35PPM PCL6"
        oHelper.cReportFile = oProp.AppStartPath + "reports\doc.frx"
        oHelper.cDataSource = PathTab
        oHelper.lAutoDropDataSource = .T.
        oHelper.cReportOutput = oProp.AppStartPath + "ReportOutput.app"
        oResult = oHelper.Execute()
    CATCH TO loError
        tcReturn = [Error: ] + STR(loError.ERRORNO) + CHR(13) + ;
        [LineNo: ] + STR(loError.LINENO) + CHR(13) + ;
        [Message: ] + loError.MESSAGE + CHR(13) + ;
        [Procedure: ] + loError.PROCEDURE + CHR(13) + ;
        [Details: ] + loError.DETAILS + CHR(13) + ;
        [StackLevel: ] + STR(loError.STACKLEVEL) + CHR(13) + ;
        [LineContents: ] + loError.LINECONTENTS
    ENDTRY
However, if i remove the TRY_CATCH, i've the same results: a blank page without no error.

New Post: Problem with printing report

$
0
0
Ok, we have two more things to test:
  1. oResult object contains a property called "cLog" that contains a text log of the printing process. Try returning the content of that property to your browser to see what is happening internally in the helper.
  2. If an error occurs while printing, an exception is catched and the Exception instance is saved on oHelper.oLastError. First, check if oLastError is not null and, if it isn't, return the value of oHelper.oLastError.Description.
I double checked that I sent to you the last version of the DLL and, if it worth it, this DLL is in use in two AVFP projects right now and works ok.


Victor

New Post: Problem with printing report

$
0
0
vespina wrote:
Ok, we have two more things to test:
  1. oResult object contains a property called "cLog" that contains a text log of the printing process. Try returning the content of that property to your browser to see what is happening internally in the helper.
  2. If an error occurs while printing, an exception is catched and the Exception instance is saved on oHelper.oLastError. First, check if oLastError is not null and, if it isn't, return the value of oHelper.oLastError.Description.
I double checked that I sent to you the last version of the DLL and, if it worth it, this DLL is in use in two AVFP projects right now and works ok.


Victor
Ok. oResult.cLog is the only expression that returning me an error into browser:
Caught .NET exception, source: PRINT.AVFP 0000a0q1004o err#= 1426 line= 188 OLE error code 0x80020006: Nome sconosciuto.1426 OLE error code 0x80020006: Nome sconosciuto. 80020006: Nome sconosciuto .NULL. .NULL. .NULL. .NULL. C:\App.....
oHelper.oLastError and try catch not returning me any error.

New Post: Problem with printing report

$
0
0
My mistake. What that error means is that there is no member in oResult called "cLog". This is because the real name is "log" (oResult.log). Please try again and let me know the content of that property.

Victor

New Post: Problem with printing report

$
0
0
Ok. With oResult.log i haven't any error (.NET exception) but this property is empty. Any idea?

New Post: Problem with printing report

$
0
0
I checked the code at Execute method and found some conditions than can cause the method to exit before adding any entries to the log property. Please, change your code to this:
 TRY
        LOCAL oHelper
        oHelper = CREATEOBJECT("avfpHelpers.avfpReportHelper")
        oHelper.cPrinterName = "35PPM PCL6"
        oHelper.cReportFile = oProp.AppStartPath + "reports\doc.frx"
        oHelper.cDataSource = PathTab
        oHelper.lAutoDropDataSource = .T.
        oHelper.cReportOutput = oProp.AppStartPath + "ReportOutput.app"
        oResult = oHelper.Execute()

        IF NOT oResult.result          && The result property indicates if the call was sucessfully handled or not
          tcReturn = oResult.data     && If something went wrong with the call (a missed parameter or a missed file), the data property contains useful info.
        ENDIF

    CATCH TO loError
        tcReturn = [Error: ] + STR(loError.ERRORNO) + CHR(13) + ;
        [LineNo: ] + STR(loError.LINENO) + CHR(13) + ;
        [Message: ] + loError.MESSAGE + CHR(13) + ;
        [Procedure: ] + loError.PROCEDURE + CHR(13) + ;
        [Details: ] + loError.DETAILS + CHR(13) + ;
        [StackLevel: ] + STR(loError.STACKLEVEL) + CHR(13) + ;
        [LineContents: ] + loError.LINECONTENTS
    ENDTRY

New Post: Problem with printing report

$
0
0
Ok. Now i see the error: "C:\ApplicazioniWeb\Progetti\webdoc\webdoc\temp\cStampa34079112 is not found ". So, the problem is the datasource but the file, in this path, exist and it is full. Why he not found it?

New Post: Problem with printing report

$
0
0
Access issue? If the file does exists, most probably the user under your app is running does not have access to that file.

Victor Espina
Viewing all 1109 articles
Browse latest View live