Page 1 of 1

Necesito ejemplo xBrowse.

PostPosted: Tue May 04, 2010 4:30 pm
by fernandomoralesdr
Hola.
Necesitaria un ejemplo de definición de un xbrowse con columnas compuestas por datos de varios archivos, por ejemplo: si el archivo del xbrowse es FACTURAS:
FACTURAS->NUMERO, CLIENTES->NOMBRE, CLIENTES->PROVINCIA, FACTURAS->IMPORTE
...y de qué manera totalizar por la columna FACTURAS->IMPORTE.
También tengo una duda: ¿cuándo utilizar FIELDS y cuándo COLUMNS? En los ejemplos de FWH no lo tengo demasiado claro.
Un saludo,
Fernando Morales

Re: Necesito ejemplo xBrowse.

PostPosted: Wed May 05, 2010 3:09 am
by JavierVital
Fernando
Yo lo hago asi :

oBrow1:aCols[03]:bStrData := {|| RetornaProvedor(COMPRAENC->PROVEDOR)}

Re: Necesito ejemplo xBrowse.

PostPosted: Wed May 05, 2010 4:25 am
by nageswaragunupudi
COLUMNS CLAUSE is a list of column names of the Alias assigned to the browse.
FIELDS clause is for any expressions. FIELDS clause is to be used for data from other related Aliases or any complext expressions.

When we want to display any field of the alias assigned to XBrowse, it is desirable to use COLUMNS clause but not FIELDS clause. When we use COLUMNS clause, XBrowse automatically reconginses fieldtype,fieldlen, fielddec and suitably decides, alignment, picture clauses and also automatically generates bOnPostEdit blocks and cSortOrder. We forgo this advantage if we use FIELDS clause or use OOPS syntax of creating columns by oBrw:AddCol(), etc. methods. We deirve the maximum power of XBrowse when we use the COMMAND syntax.

When both COLUMNS and FIELDS clauses are speicified, XBrowse places the columns first and then the fields. We can later rearrange the sequence of xbrowse columns.

Here is an example assuming 2 DBFs BILLS and CUSTOMER.


Code: Select all  Expand view

USE BILLS
USE CUSTOMER ALIAS CUST
SET ORDER TO CUSTID
SELECT BILLS
SET RELATION TO CUSTID INTO CUST

@ 10,10 XBROWSE oBrw SIZE 400,300 PIXEL OF oDlg ;
  COLUMNS 'NUMBER', 'CUSTID', 'QUANTITY', 'RATE' ;
  FIELDS CUST->CUSTNAME, CUST->STATE, BILLS->QUANTITY * BILLS->RATE ;
  HEADERS 'BillNo', 'ID', 'Quantity', 'Rate', 'Customer', 'State', 'Amount' ;
  PICTURES nil, nil, nil, nil, nil, nil, '999,999.99' ;
  ALIAS BILLS

  // we defined picture clause only for the last calculated column.
  // XBrowse automatically decides picture clauses for NUMBER,CUSTID,QUANITY and RATE
  // based on the DbStruct() of BILLS.

  oBrw:ReArrangeCols( 'BillNo', 'ID', 'Customer', 'State', 'Quantity', 'Rate', 'Amount' )
  oBrw:nStretchCol := STRETCHCOL_WIDEST

 


bStrData
FiveWin discourages use of bStrData directly. This should be left for internal use by the XBrowse column object. Instead, it is desirable to assign the codeblock to oCol:bEditValue and specify the picture in oCol:cEditPicture. Still it is a lot more advantageous to use the COMMAND syntax rather than the OOPS style.

Gracias por las respuestas.

PostPosted: Wed May 05, 2010 6:57 am
by fernandomoralesdr
Gracias por sus respuestas.
Bueno, con lo que me han contestado ya me voy haciendo una idea del funcionamiento porque la que he encontrado en el wiki y los ejemplos es un tanto "difusa" y no está 100% documentada. Al ser un control nuevo para mi me encuentro con mucha data y métodos nuevos.
Gracias de nuevo y un saludo,
Fernando Morales
Las Palmas de Gran Canaria