replace value on xbrowse ( tdatabase)

replace value on xbrowse ( tdatabase)

Postby Silvio.Falconi » Tue Apr 20, 2021 8:50 am

I open the reserva.dbf with Tdatabase and build axbrowse

Image

I need to calc the days on the Seven column ( red column)

WITH OBJECT oBrowse:aCols[ 7]
:bEditValue := TotalDays(oBrowse)
END

I tried with ( but not run ok )

Function TotalDays(oBrowse)
local nRecord := oBrowse:narrayat
local dStart := oBrowse:aArrayData[nRecord][5]
local dEnd := oBrowse:aArrayData[nRecord][6]
local nGiorni:= (dEnd-dStart)+1
*oBrowse:aCols[7]:VarPut(nGiorni)
return nGiorni

any solution ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: replace value on xbrowse ( tdatabase)

Postby Marc Venken » Tue Apr 20, 2021 11:46 am

Silvio,

Maybe a good solution is to change the data/header that the column is showing the calculated data automatic when you setup the browse.

I have seen code like this :


ADD TO oBrw HEADER "NET" DATA ROUND( oBrw:aRow[5] * oBrw:aRow[7] - oBrw:aRow[ 8 ], 0 ) ;
PICTURE "999,999,999"
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1426
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: replace value on xbrowse ( tdatabase)

Postby Marc Venken » Tue Apr 20, 2021 11:49 am

.Or.
Code: Select all  Expand view


WITH OBJECT :PRIJS
    :nEditType     := EDIT_GET
    :bOnChange     := { |oCol,uOldVal| Herberekening( oLbxdet, oCol:Value ) }
    :bKeyChar      := { |k| If( k == VK_RETURN, ( oLbxdet:GoRight(), 0 ), nil ) }
ENDWITH


function Herberekening(oBrw,oCol)
  local nTotaal:=0
  nTotaal = (oBrw:BES:value * oBrw:prijs:value) - ;
            ((oBrw:BES:value*oBrw:prijs:value)*oBrw:kor:value/100)
  oBrw:totaal:varput(nTotaal)
  oBrw:BACK:varput(oBrw:BES:value - oBrw:LEV:value)
  oBrw:MakeTotals()
  oBrw:refresh()
return .t.



 
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1426
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: replace value on xbrowse ( tdatabase)

Postby nageswaragunupudi » Tue Apr 20, 2021 1:52 pm

Code: Select all  Expand view
oBrowse:aCols[ 7 ]:bEditValue := { || oBrowse:oCol(6):Value - oBrowse:oCol(5):Value + 1 }
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: replace value on xbrowse ( tdatabase)

Postby Silvio.Falconi » Wed Apr 21, 2021 8:08 am

nageswaragunupudi wrote:
Code: Select all  Expand view
oBrowse:aCols[ 7 ]:bEditValue := { || oBrowse:oCol(6):Value - oBrowse:oCol(5):Value + 1 }
 


thanks rao I sent you the test
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 117 guests