In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

AdsConnection() tables

FastReport for Xailer & [x]Harbour (English/Spanish)
Responder
reinaldocrespo
Mensajes: 11
Registrado: Mar Oct 29, 2013 1:49 am

AdsConnection() tables

Mensaje por reinaldocrespo »

Hi.
It seems to me like Frx's SetWorkArea() method does not work properly with Ads Remote server connection tables. I wrote a short self-contained sample to demonstrate. Using FrConsole.prg sample code provided with frx I added the function below. Then changed option #6 to execute TestWAdsConnection() instead of Sergey(). Execution stops right at :SetWorkArea( "customers" ) and never recovers.
Perhaps Frx's SetWorkArea() was never intended to work with ADS remote tables?
Please help.

//------------------------------------------------------------------------------
FUNCTION TestWAdsConnection()
LOCAL oReport, oCustomer, oOrders
CLS
@ 0, 0 SAY PadC( "*** FastReport Sergey compatibility mode sample ***", 80 ) color "N/W"
SetPos( 1, 0 )
? "Connecting...."

rddRegister( "ADS", 1 )
rddsetdefault( "ADS" )
ADSSetServerType( ADS_REMOTE_SERVER )
AdsSetFileType( ADS_ADT )
AdsRightsCheck( 1 )
AdsLocking( ADS_PROPRIETARY_LOCKING )
IF !AdsConnect60( "juanluis:49000adsdata2sfirestoremp.add", ;
ADS_REMOTE_SERVER, ;
"UserCode", ;
"Password", ;
ADS_TCP_IP_CONNECTION )
? "cannot connect to remote ads server"
RETURN NIL

ENDIF
? "Connected ...."

Dbusearea( .T. ,"ADS" , "customers","customers" , .T., .F. )
? "File Opened...."
WITH OBJECT oReport := frReportManager():New()
:SetWorkArea( "customers" )
? "WorkArea has been set...." // **This line never shows on console.
:bOnAfterLoad := {|| QOut( "Report loaded" ) }
:bOnClickObject := {|oSender, cObject| QOut( "Mouse click on object: " + cObject ) }
:bOnEndPreview := {|| QOut( "Report preview window closed" ) }
:bOnBtnSendMail := {|| Alert( "Email" ), 1 }
:bOnBtnPrint := {|| Alert( "Print" ), 1 }
:bOnBtnGenPdf := {|| Alert( "Gen PDF" ), 1 }
:cFilename := ".ReportsAdsConnection.fr3"
? "Ready to show...."
IF !lDesign
:ShowReport()
ELSE
:DesignReport()
ENDIF
:End()
END WITH
CLOSE ALL
ADSDisconnect()

? ""
? "Push any key to continue."
Inkey( 0 )
RETURN NIL

Reinaldo.
Avatar de Usuario
ignacio
Site Admin
Mensajes: 8775
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

AdsConnection() tables

Mensaje por ignacio »

Hello,
Without a sample or a error.log is impossible to know what is exactly happening on your code. I assume the program runs on a endless loop.
A ADS alias should work in the same way as any other DBF alias, so there should be no differences between a native RDD or ADS.
The code of frReportManager:SetWorkArea() is given, so it should be easy to put some traces on that code to see what is happening.
Sorry for not giving you a better answer.
Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
reinaldocrespo
Mensajes: 11
Registrado: Mar Oct 29, 2013 1:49 am

AdsConnection() tables

Mensaje por reinaldocrespo »

I did not realize the code for the function was provided. You are right, I should be able to trace the problem. Unfortunately I will be on a road trip for the next 10 days. I will get back to this subject as soon as I return.
Thank you.
Reinaldo.
reinaldocrespo
Mensajes: 11
Registrado: Mar Oct 29, 2013 1:49 am

AdsConnection() tables

Mensaje por reinaldocrespo »

Hi,
After doing some debugging of the source code that comes in frxsource I was able to find the problem.
It seems like this FR implementation can't handle extended field types. My source .adt table has a few fields of types other than C,N,D,L. As soon as a binary field is encountered on the source data, FRX brakes with this error information:
Quote:
"Error Base/1604 Argument error:Switch.

The error happens on line 423 of source file FrDataSet.prg.
To reproduce el error, create a .adt table including a Binary field type, a ModTime field type, and TimeStamp field type. Populate the table and then try using that table as the source data file on oFrx:SetWorkArea().
FYI- this is not a problem with Sergey's implementation of FastReports.
BTW - it takes forever and ever for the source data file to load into the array. In the meanwhile nothing happens. It causes the impression that the system is hung. You may reproduce this behavior by using a table with 500k records where each record contains over 30 fields.
Best regards,
Reinaldo.
Avatar de Usuario
ignacio
Site Admin
Mensajes: 8775
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

AdsConnection() tables

Mensaje por ignacio »

Hello,
Please could you send a small ADS table with all those field types. TIA.
About your second issue:
1) I suggest you only send the fields you need to print
2) We can inmplement a event to show a progress bar when the report is loading its data, but that will consume also time. BTW, I believe is not very usual to create a report of 500,0000 records. Just for curiosity: How many output pages produces?
3) If at any time you move to a SQL BD, which I obviously recommend then you will have this same problem even with Sergey software.
4) I suggest you access through ADO as I told you before. Surely there is ADO for ADS. In that case the data goes directly to the report and is not treated by any Harbour code. BTW, I am almost sure that you will have the same lag.
Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
reinaldocrespo
Mensajes: 11
Registrado: Mar Oct 29, 2013 1:49 am

AdsConnection() tables

Mensaje por reinaldocrespo »

Ignacio;
Please feel free to use the code below to test with .adt tables. You will only need to populate the tables to test FRX.

//--------------------------------------------------------------------------------------
//function CreateTables() will create three tables using stnd harbour func dbCreate
//Each table structure is saved on an array following the std returned by dbStruct()
//Each element on the array is an array describing the field. Thus, the array
//for a table with 3 fields would look like this:
//aStructure := { { cFieldName1, cFieldType1, nFldWidth, nDecimals },;
// { cFieldName2, cFieldType2, nFldWidth, nDecimals },;
// { cFieldName3, cFieldType3, nFldWidth, nDecimals } }
//
//Function CreateTables() uses regular Clipper RDD calls. I rather do all this using
//SQL and will take the time on a later sample to show how to create and maintain
//tables using SQL while still using array structures to house table structure information
//with the same format used here which follows dbStruct() format.
STATIC FUNCTION CreateTables()
LOCAL cAlias := "MyAlias"
LOCAL afiles := {}
LOCAL cFileName, e
//---------------------- customers.adt --------------------------------------------
LOCAL aStruc := { { "cust_id" , "C", 10, 0 },;
{ "Sequence" , "AutoInc", 07, 0 },; //ADT extended field type autoincrement
{ "customer_name" , "C", 25, 0 },;
{ "Start_date" , "TimeStamp", 01, 0 },; //ADT extended field type
{ "Photo" , "binary", 01, 0 },; //ADT extended field type
{ "Notes" , "M", 10, 0 } }

AdsSetFileType( ADS_ADT )
TRY
dbCreate( ( cFileName := cPath + "customers" ), aStruc,, .t., cAlias )
( cAlias )->( OrdCreate( cPath + "customers", "cust_id", "cust_id" ) )
( cAlias )->( OrdCreate( cPath + "customers", "Start_date", "Start_date" ) )
( cAlias )->( dbclosearea() )
(cAlias)->( dbclosearea() )
AADD( afiles, { cFileName, "customers.adi" } )

//------------------------ sales.dbf -------------------------------------------------
//ADS_VFP should not be confused with ADS_CDX. The first is a NEWER fox pro table
//format that extends field types. I'm testing here with VFP tables to show the
//use of extended fields, but keep in mind that most xbase developers are still
//using regular CDX tables and for that you should use ADS_CDX filetype.

aStruc := { { "cust_id" , "C", 10, 0 },;
{ "invoice" , "C", 15, 0 },;
{ "s_date" , "TimeStamp", 01, 0 },; //VFP extended field type
{ "item_id" , "C", 15, 0 },;
{ "Units" , "N", 03, 0 },;
{ "Price" , "Money", 09, 2 },; //VFP extended field type
{ "Notes" , "M", 10, 0 } }

AdsSetFileType( ADS_VFP ) //Notice this is NOT ADS_CDX. Extended field types
//such as TimeStamp will not work with ADS_CDX.
dbCreate( ( cFileName := cPath + "sales.dbf" ), aStruc,, .t., cAlias )
( cAlias )->( OrdCreate( cPath + "sales", "invoice", "invoice" ) )
( cAlias )->( OrdCreate( cPath + "sales", "cust_id", "cust_id" ) )
( cAlias )->( dbclosearea() )
aadd( afiles, { cFileName, "sales.cdx" } )
//------------------------ items.dbf -------------------------------------------------
//Below I'm using old fashioned DBF/NTX tables. Very little value as opposed to
//ADT/ADI tables. The purpose here is only to show that it also works with ADS.

aStruc := { { "item_id" , "C", 15, 0 },;
{ "Desc" , "C", 25, 0 },;
{ "Price" , "N", 07, 2 } }

AdsSetFileType( ADS_NTX )
dbCreate( ( cFileName := cPath + "items.dbf" ), aStruc,, .t., cAlias )
( cAlias )->( OrdCreate( cPath + "itm_id",, "item_id" ) )
( cAlias )->( OrdCreate( cPath + "itm_desc",, "Desc" ) )
( cAlias )->( dbclosearea() )
aadd( afiles, { cFileName, "itm_id.ntx;itm_desc.ntx" } )
CATCH e

ShowError( cFileName, e )
afiles := {}

END
RETURN a files

On your #3, Sql bd? I think you meant SQL engine such as MS-SQL. If so, ADS is a perfect choice of SQL.
On #4, I'm quite happy with ADS as my sql of choice and as far as I know, i'm better off using the native ADS RDD + ACE than any ADO middleware. I really was never planning on abandoning ADS RDD + ACE in preference of any other SQL. I hope you can understand.
I don't want to give up on FRX, I think it has potential. IMO, this implementation of fast report is not better than Sergey's as you argue on your posts and I mean no offense. I only mean that Sergey's implementation did not force you to work exclusively with ADO. The main problem right now is what I perceive as a lack of interest on doing a more complete job with FRX. Instead of steering development away from native RDD and in favor of ADO, I think you should at least attempt to work with harbour's native rdds. Trust me, theres is going to be ADS RDDs for a long time.
I really do hope you are persuaded to try to make FRX completely compatible with ADSRDDs without forcing ADO. Also, please do consider implementing the use of datasources without loading the complete dataset into a memory array. Thank you.
Reinaldo.
Avatar de Usuario
ignacio
Site Admin
Mensajes: 8775
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

AdsConnection() tables

Mensaje por ignacio »

Hello,
On my tests the new field types are not recognised correctly and no value is shown on the report, but there is no run-time error.
BTW, the bug is fixed it will be available on next release.
Regards
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Responder