hi Enrico, thank you for your help but if I remove single quote xbrowse goes in myfunction only one time.
I changed my prg:
- Code: Select all Expand view
...
oYORD := FW_OpenRecordSet( oCn, tuple, 1 )
oYORD:MoveFirst()
DEFINE DIALOG oDlg2 SIZE 800,500 PIXEL FONT oFont;
STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
WS_MAXIMIZEBOX, WS_MINIMIZEBOX, WS_THICKFRAME ) ;
TITLE "ANALISI IMPLOSIONE: "+m_get[02]
@ 40,10 XBROWSE oBrw SIZE -10,-50 PIXEL ;
RECORDSET oYord ;
COLUMNS "LEVEL", "FIELD1", "FIELD2", "TIPO", "TIME", "PROGR", MRP00421(oYORD:Fields("FIELD1"):value,oCn) ;
HEADERS "LIV", "BASE", "APERTO", "TIPO", "LEAD", "PROGR", "IN ORDINE" ;
PICTURE "@ZE 999",,,,"@ZE 999", "@ZE 999" ;
OF oDlg2
...
Return NIL
*-----------------------------------------------------------------------------------
FUNCTION MRP00421(field, oCn)
local tuple, oRs
local totale := 0
msginfo(Field)
tuple := +;
"SELECT a.Totale as Totale..." +;
etc...etc...etc...
"WHERE ARTICOLO = '"+FIELD+"' AND WORKIT = 8 "
etc... etc...
oRs := FW_OpenRecordSet( oCn, tuple, 1 )
if oRs:EOF()
totale = 0.00
else
oRs:MoveFirst()
totale = oRs:Fields("Totale"):value
msginfo(str(totale))
endif
oRs:Close()
Return Str(Totale)
I put MSGINFO into FUNCTION MRP00421 for check FIELD and it shows me msginfo only one time with NULL field.
the original RECORDSET oYord in XBROWSE had 25 rows and MRP00421 function should return calculate TOTALE (in another SELECT) for each row.
but COLUMN "IN ORDINE" in XBROWSE retrun 0,00 in each row
I have another my XBROWSE:
- Code: Select all Expand view
DEFINE DIALOG oDlg2 SIZE 800,500 PIXEL FONT oFont;
STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
WS_MAXIMIZEBOX, WS_MINIMIZEBOX, WS_THICKFRAME ) ;
TITLE "SCHEDA MOVIMENTI DI ACQUISTO FORNITORE: "+CDFOR
@ 40,10 XBROWSE oBrw SIZE -10,-50 PIXEL ;
RECORDSET oRsMovimenti ;
COLUMNS 'dAAAAMMGGadata(DATA)',"CODICE","DESCR","RIFER","QTA","IMPORT","COSTO" ;
HEADERS "DATA","CODICE","DESCRIZIONE","RIFERIM.","QUANTITA","IMPORTO","COSTO" ;
PICTURE ,,,,"@ZE 99,999,999.999", "@ZE 99,999,999.999", "@ZE 99,999,999.999" ;
in this XBROWSE there is dAAAAMMGGadata FUNCTION whit single quotes that convert field DATA from YYYYMMDD to DD/MM/YYYY and it works for each row in oRsMovimenti
thank you
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)