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.

How do I make REPORT columns to access an array?

Xailer professional forum in English
Responder
ChrisGillard
Mensajes: 384
Registrado: Mar May 01, 2007 5:49 pm

How do I make REPORT columns to access an array?

Mensaje por ChrisGillard »

I am having trouble understanding how I can use blocks to access array elements in a REPORT column. I think it is my understanding of blocks, binding and technical stuff!
My example code shows a few simple columns and a for/next to make columns that access a parse of a data field. I try to macro compile a block to include the element number 'n' as a string?
I also try to number the column titles
The logdisplay image shows the cBlock .... looks promising.
The output image shows the printed report.
The column titles are all 5 ... my loop is 1 to 4?
The data printed 'File Exported' is the 4th element of the 1st records EVENT string .... but it is printed in all columns and for all records.
Any help would be appreciated, thanks.


Attached files
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9469
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

How do I make REPORT columns to access an array?

Mensaje por ignacio »

Hello,
nPos := 1
aData := {....}
COLUMN ... DATA aData[1, nPos] ...
COLUMN ... DATA aData[2, nPos] ...
COLUMN ... DATA aData[3, nPos] ...
oReport:bSkip := {|| nPos++ }
oReport:bWhile := {|| nPos <= Len( aData ) }
Regards,
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9469
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

How do I make REPORT columns to access an array?

Mensaje por ignacio »

BTW,
>> DATA bBlock
That is incorrect. The command COLUMN makes a block with the DATA clause. So it should be:
cBlock := "Eval(...)"
BTW, if you do not use the COMMAND COLUMN then it will be ok.
Regards,
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
ChrisGillard
Mensajes: 384
Registrado: Mar May 01, 2007 5:49 pm

How do I make REPORT columns to access an array?

Mensaje por ChrisGillard »

Hi Ignacio,
Thank you for helping.
In your second post I am understanding the the command syntax will make the block for me, ok.
I'm not understanding what should the cBlock string really look like in my situation.
I could do with you cBlock := line being more detailed.
I also worry that in my situation I am making these extra columns in a loop and they are a variable number of columns required depending on the parse of the data on the YEVET->EVENT field.
Just a little more help would be fantastic.
Thanks
Chris
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9469
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

How do I make REPORT columns to access an array?

Mensaje por ignacio »

ChrisGillard escribió el jue, 06 junio 2013 18:53Hi Ignacio,
Thank you for helping.
In your second post I am understanding the the command syntax will make the block for me, ok.
I'm not understanding what should the cBlock string really look like in my situation.
I could do with you cBlock := line being more detailed.
I also worry that in my situation I am making these extra columns in a loop and they are a variable number of columns required depending on the parse of the data on the YEVET->EVENT field.
Just a little more help would be fantastic.
Thanks
Chris
Take a look of this code:
METHOD Report( cTitle ) CLASS TDBBrowse
LOCAL oReport, oCol
DEFAULT cTitle TO ::oDataset:cName
REPORT oReport ;
TITLE cTitle ALIGN taLEFT ;
PREVIEW MODAL ;
DATASET ::oDataset
FOR EACH oCol IN ::aCols
WITH OBJECT oReport:AddColumn()
:aTitle := { {|| oCol:cHeader } }
:aData := { {|| oCol:Value } }
:Create()
END WITH
NEXT
oReport:Run()
RETURN NIL
This is a simple code to include a Report() method to any TDBBrowser. As you can see we have use the command for the report creation, bu the columns have been created directly. The property TColumn:aData is an array of codeblocks but its complexity is hidden by the command.
In your case it will be something like this:
oColumn1:aData := { {|| aData[ nFor, 1 ] } }
oColumn2:aData := { {|| aData[ nFor, 2 ] } }
oColumn3:aData := { {|| aData[ nFor, 3 ] } }
I hope it helps.
Best regards,
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
ChrisGillard
Mensajes: 384
Registrado: Mar May 01, 2007 5:49 pm

How do I make REPORT columns to access an array?

Mensaje por ChrisGillard »

Hi Ignacio,
Thanks for the detailed explanation of how to do this including how to use an array for each column.
I note also you are using TReport on a dbfdataset which is very useful as my understanding was it could only use TReport on USE MYDBF type of code. By re reading the help file I see you say it is initially configured that way but with the skip block of course we can be much more flexible!
Over the weekend I did get round my problem by using 'dummy' columns and the using OnPrintData, oPrintTitle & bSkip to achieve the same thing.

Same end result I think.
As always Xailer does the job when you know how.
Thanks again.
Chris


Attached files
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9469
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

How do I make REPORT columns to access an array?

Mensaje por ignacio »

Hi Crhis,
Glad you got it!! BTW, sorry for the delay on answering.
Best regards,
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Responder