Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #1866 > unrolled thread

Calculate a total in bBrowser3 for a VirtualFieldColumn

Started byGrant <grantd@dunsmoreinfo.com>
First post2011-08-22 20:03 -0700
Last post2011-08-24 15:18 -0700
Articles 14 — 6 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Calculate a total in bBrowser3 for a VirtualFieldColumn Grant <grantd@dunsmoreinfo.com> - 2011-08-22 20:03 -0700
    Re: Calculate a total in bBrowser3 for a VirtualFieldColumn "Stephen Quinn" <stevejqNO@bigpondSPAM.net.au> - 2011-08-23 17:31 +1000
      Re: Calculate a total in bBrowser3 for a VirtualFieldColumn Grant <grantd@dunsmoreinfo.com> - 2011-08-23 09:35 -0700
        Re: Calculate a total in bBrowser3 for a VirtualFieldColumn "Stephen Quinn" <stevejqNO@bigpondSPAM.net.au> - 2011-08-24 10:38 +1000
          Re: Calculate a total in bBrowser3 for a VirtualFieldColumn Grant <grantd@dunsmoreinfo.com> - 2011-08-24 15:16 -0700
            Re: Calculate a total in bBrowser3 for a VirtualFieldColumn "Stephen Quinn" <stevejqNO@bigpondSPAM.net.au> - 2011-08-25 10:30 +1000
            Re: Calculate a total in bBrowser3 for a VirtualFieldColumn Karl Faller <k.faller_withoutthat_@onlinehome.de> - 2011-08-25 10:09 +0200
            Re: Calculate a total in bBrowser3 for a VirtualFieldColumn "Simon Goodman" <simon.spam@spam.abersoftware.co.uk> - 2011-08-25 12:48 +0100
              Re: Calculate a total in bBrowser3 for a VirtualFieldColumn Grant <grantd@dunsmoreinfo.com> - 2011-08-25 12:25 -0700
                Re: Calculate a total in bBrowser3 for a VirtualFieldColumn "Stephen Quinn" <stevejqNO@bigpondSPAM.net.au> - 2011-08-26 09:43 +1000
    Re: Calculate a total in bBrowser3 for a VirtualFieldColumn Joachim Bieler <support@votools.com> - 2011-08-24 08:04 +0200
      Re: Calculate a total in bBrowser3 for a VirtualFieldColumn "richard.townsendrose" <richard.townsendrose@gmail.com> - 2011-08-24 02:09 -0700
        Re: Calculate a total in bBrowser3 for a VirtualFieldColumn Joachim Bieler <support@votools.com> - 2011-08-25 07:21 +0200
      Re: Calculate a total in bBrowser3 for a VirtualFieldColumn Grant <grantd@dunsmoreinfo.com> - 2011-08-24 15:18 -0700

#1866 — Calculate a total in bBrowser3 for a VirtualFieldColumn

FromGrant <grantd@dunsmoreinfo.com>
Date2011-08-22 20:03 -0700
SubjectCalculate a total in bBrowser3 for a VirtualFieldColumn
Message-ID<7dfe0be5-0fde-4c84-8a61-93a7ed442bb3@l8g2000prd.googlegroups.com>
I would like to total the values from a VirtualFieldColumn to display
at the end of a display but I don't know see how to do this. I have
tried the Sum() method by using the generic virtual value #expression
but that dosen't work so I have been looking for a sample with
something like this but so far been unsuccessful. Any help would be
appreciated. Thank you

[toc] | [next] | [standalone]


#1869

From"Stephen Quinn" <stevejqNO@bigpondSPAM.net.au>
Date2011-08-23 17:31 +1000
Message-ID<III4q.992$7r4.391@viwinnwfe02.internal.bigpond.com>
In reply to#1866
Grant

>I would like to total the values from a VirtualFieldColumn to display
> at the end of a display but I don't know see how to do this. I have

Where does the data for the VirtualFieldColumn come from??
Have you tried summing the data from the source that fills the 
VirtualFieldColumn??

I doubt you can ever total a VirtualFieldColumn due to it being 
virtuous^H^H^H^Hal<bg>

CYA
Steve 

[toc] | [prev] | [next] | [standalone]


#1870

FromGrant <grantd@dunsmoreinfo.com>
Date2011-08-23 09:35 -0700
Message-ID<5f970237-b993-4b81-902e-399b0a4afc99@m4g2000pri.googlegroups.com>
In reply to#1869
On Aug 23, 12:31 am, "Stephen Quinn" <stevej...@bigpondSPAM.net.au>
wrote:
> Grant
>
> >I would like to total the values from a VirtualFieldColumn to display
> > at the end of a display but I don't know see how to do this. I have
>
> Where does the data for the VirtualFieldColumn come from??
> Have you tried summing the data from the source that fills the
> VirtualFieldColumn??
>
> I doubt you can ever total a VirtualFieldColumn due to it being
> virtuous^H^H^H^Hal<bg>
>
> CYA
> Steve

The data comes from other columns in the browser. I can calculate each
line in the source file and then sum them (loop and accumulate values)
but I was wondering if it could be done within the browser.

[toc] | [prev] | [next] | [standalone]


#1871

From"Stephen Quinn" <stevejqNO@bigpondSPAM.net.au>
Date2011-08-24 10:38 +1000
Message-ID<sFX4q.1033$7r4.161@viwinnwfe02.internal.bigpond.com>
In reply to#1870
Grant

What you need to do is apply the calculations to the fields in a seperate 
function/method.
You could use something like the following and call it whenever you think 
it's required

// Untested code
method TotalVColumn() class MyBrowser

    local nVTotal AS FLOAT

    SELF:Server:SuspendNotification()
    nRecNo := SELF:Server:RecNo
    nVTotal := 0.0

    // The codeblock is the same calc you used to populate the Virtual 
column
    SELF:Server:Eval( {|| nVTotal += (FLD1 + FLD2) / FLD3 },,,DBSCOPEALL)

    SELF:Server:RecNo := nRecNo
    SELF:Server:ResetNotification()
    SELF:nTotal := nVTotal    // Update the total on the window/broswer
    RETURN 

[toc] | [prev] | [next] | [standalone]


#1882

FromGrant <grantd@dunsmoreinfo.com>
Date2011-08-24 15:16 -0700
Message-ID<2847a69f-9570-469b-a092-ae0af7a594ef@p10g2000yqi.googlegroups.com>
In reply to#1871
On Aug 23, 5:38 pm, "Stephen Quinn" <stevej...@bigpondSPAM.net.au>
wrote:
> Grant
>
> What you need to do is apply the calculations to the fields in a seperate
> function/method.
> You could use something like the following and call it whenever you think
> it's required
>
> // Untested code
> method TotalVColumn() class MyBrowser
>
>     local nVTotal AS FLOAT
>
>     SELF:Server:SuspendNotification()
>     nRecNo := SELF:Server:RecNo
>     nVTotal := 0.0
>
>     // The codeblock is the same calc you used to populate the Virtual
> column
>     SELF:Server:Eval( {|| nVTotal += (FLD1 + FLD2) / FLD3 },,,DBSCOPEALL)
>
>     SELF:Server:RecNo := nRecNo
>     SELF:Server:ResetNotification()
>     SELF:nTotal := nVTotal    // Update the total on the window/broswer
>     RETURN

Hello Steve
I have done as you suggested and it works fine to calculate the total
but
how do I display this total on the browser? Ideally I would like to
have the total
always visable at the bottom of the browser display screen.

[toc] | [prev] | [next] | [standalone]


#1883

From"Stephen Quinn" <stevejqNO@bigpondSPAM.net.au>
Date2011-08-25 10:30 +1000
Message-ID<5Fg5q.1043$NR2.748@viwinnwfe01.internal.bigpond.com>
In reply to#1882
Grant

>>
how do I display this total on the browser? Ideally I would like to
have the total always visable at the bottom of the browser display screen.
<<
I usually displayed totals on the window itself (Fixtest) never in a browser 
(unless it was an array where the last element was the total and everything 
was visible on screen (eg 1-20 lines)).

Can bBrowser be set up to show totals at the bottom of the display??
Is there anything in the bBrowser samples that would explain what how you 
set it up to show totals??


CYA
Steve

[toc] | [prev] | [next] | [standalone]


#1889

FromKarl Faller <k.faller_withoutthat_@onlinehome.de>
Date2011-08-25 10:09 +0200
Message-ID<5o0c571quov1sk8p0vlvha8fjcoe7ec4qq@4ax.com>
In reply to#1882
On Wed, 24 Aug 2011 15:16:28 -0700 (PDT), Grant
<grantd@dunsmoreinfo.com> wrote:

>Hello Steve
>I have done as you suggested and it works fine to calculate the total
>but
>how do I display this total on the browser? Ideally I would like to
>have the total
>always visable at the bottom of the browser display screen.
Years ago i tried to use the footer for those purpose, but IIRC didn't
succeed - but maybe in newer versions it is possible - ask Joachim...

Karl

[toc] | [prev] | [next] | [standalone]


#1891

From"Simon Goodman" <simon.spam@spam.abersoftware.co.uk>
Date2011-08-25 12:48 +0100
Message-ID<KEq5q.163888$Z04.107820@newsfe07.ams2>
In reply to#1882
Hi Grant,

You can set a footer for each bBrowser column - similar to how you set 
captions - just remember to set the footer height > 0 - took a little while 
to find that one. The column totals then move with the browser as you'd 
expect.

To setup the bBrowser initially
obBrowser:FooterHeight := 20

For each column you want a total
oDataColumn:FooterVisible := TRUE

Set a different colour for the footers so they stand out
oDataColumn:FooterView := bViewStyle{SELF:FooterView:Foreground, 
Brush{aBBColours[DSCAPBACK]}}

Then to update the total - convert to string
oDataColumn:Footer := Str(aTotalValues[dwFieldNo],12,2)

I think thats all thats needed.

HTH

Simon


"Grant"  wrote in message 
news:2847a69f-9570-469b-a092-ae0af7a594ef@p10g2000yqi.googlegroups.com...

On Aug 23, 5:38 pm, "Stephen Quinn" <stevej...@bigpondSPAM.net.au>
wrote:
> Grant
>
> What you need to do is apply the calculations to the fields in a seperate
> function/method.
> You could use something like the following and call it whenever you think
> it's required
>
> // Untested code
> method TotalVColumn() class MyBrowser
>
>     local nVTotal AS FLOAT
>
>     SELF:Server:SuspendNotification()
>     nRecNo := SELF:Server:RecNo
>     nVTotal := 0.0
>
>     // The codeblock is the same calc you used to populate the Virtual
> column
>     SELF:Server:Eval( {|| nVTotal += (FLD1 + FLD2) / FLD3 },,,DBSCOPEALL)
>
>     SELF:Server:RecNo := nRecNo
>     SELF:Server:ResetNotification()
>     SELF:nTotal := nVTotal    // Update the total on the window/broswer
>     RETURN

Hello Steve
I have done as you suggested and it works fine to calculate the total
but
how do I display this total on the browser? Ideally I would like to
have the total
always visable at the bottom of the browser display screen. 

[toc] | [prev] | [next] | [standalone]


#1893

FromGrant <grantd@dunsmoreinfo.com>
Date2011-08-25 12:25 -0700
Message-ID<1093328e-4710-4276-a0a8-0e7905c72266@r8g2000prd.googlegroups.com>
In reply to#1891
On Aug 25, 4:48 am, "Simon Goodman"
<simon.s...@spam.abersoftware.co.uk> wrote:
> Hi Grant,
>
> You can set a footer for each bBrowser column - similar to how you set
> captions - just remember to set the footer height > 0 - took a little while
> to find that one. The column totals then move with the browser as you'd
> expect.
>
> To setup the bBrowser initially
> obBrowser:FooterHeight := 20
>
> For each column you want a total
> oDataColumn:FooterVisible := TRUE
>
> Set a different colour for the footers so they stand out
> oDataColumn:FooterView := bViewStyle{SELF:FooterView:Foreground,
> Brush{aBBColours[DSCAPBACK]}}
>
> Then to update the total - convert to string
> oDataColumn:Footer := Str(aTotalValues[dwFieldNo],12,2)
>
> I think thats all thats needed.
>
> HTH
>
> Simon
>
Hi Simon
I had played with the footer before without success but thanks to your
help it is working fine. I am using a loop to calculate the total:
    DO While ! EOF()
	nTotal := ((odbsServer:WEIGHT)*(odbsServer:TRATE) +
(odbsServer:HRS)*(odbsServer:HRATE))
	nSubTotal := nSubTotal+nTotal
	skip
    ENDDO
    oColumn:Footer := nSubTotal
Then this value is displayed in a column footer. If I make a change in
any of the data fields I can't get the browser to do an immediate
update unless I exit
and reenter the page. I have put this loop into the browser following
the VirtualFieldColumn and I don't know if this is correct syntax or
not and then tried
to update the brower unsuccessfully as follows:
 
oDCbBrowser1:Notify(NOTIFYCOMPLETION)
      oDCbBrowser1:Recalculate()
      oDCbBrowser1:Redraw(#Footer)
      oDCbBrowser1:Refresh()
What do I need to do to cause the browser to update the footer in real
time?

Thanks again for your help.

> "Grant"  wrote in message
>
> news:2847a69f-9570-469b-a092-ae0af7a594ef@p10g2000yqi.googlegroups.com...
>
> On Aug 23, 5:38 pm, "Stephen Quinn" <stevej...@bigpondSPAM.net.au>
> wrote:
>
>
>
>
>
> > Grant
>
> > What you need to do is apply the calculations to the fields in a seperate
> > function/method.
> > You could use something like the following and call it whenever you think
> > it's required
>
> > // Untested code
> > method TotalVColumn() class MyBrowser
>
> >     local nVTotal AS FLOAT
>
> >     SELF:Server:SuspendNotification()
> >     nRecNo := SELF:Server:RecNo
> >     nVTotal := 0.0
>
> >     // The codeblock is the same calc you used to populate the Virtual
> > column
> >     SELF:Server:Eval( {|| nVTotal += (FLD1 + FLD2) / FLD3 },,,DBSCOPEALL)
>
> >     SELF:Server:RecNo := nRecNo
> >     SELF:Server:ResetNotification()
> >     SELF:nTotal := nVTotal    // Update the total on the window/broswer
> >     RETURN
>
> Hello Steve
> I have done as you suggested and it works fine to calculate the total
> but
> how do I display this total on the browser? Ideally I would like to
> have the total
> always visable at the bottom of the browser display screen.- Hide quoted text -
>
> - Show quoted text -

[toc] | [prev] | [next] | [standalone]


#1894

From"Stephen Quinn" <stevejqNO@bigpondSPAM.net.au>
Date2011-08-26 09:43 +1000
Message-ID<21B5q.1150$7r4.585@viwinnwfe02.internal.bigpond.com>
In reply to#1893
Grant

> What do I need to do to cause the browser to update the footer in real 
> time?

Whenever you edit the data you need to call your calc method manually or you 
can do it simply by adding/subtracting from the known total.
Eg
METHOD EditButtonClick() CLASS Whatever
   // Edit the data
   // Call the do while loop and update the footer
or
METHOD EditButtonClick() CLASS Whatever
    nValue1 := oBB:GetColumnValue()
    // Edit the data
    nValue2 := oBB:GetColumnValue()
    SELF:nTotal += ( nValue - nValue2 )
    oCol:Footer := STR(SELF:nTotal, 10,2)
or
In the notify method
    IF SELF:lChanged
        // Only set when the data has been edited
        SELF:lChanged := FALSE
        // Call the do while loop and update the footer
    ENDIF

> nTotal := ((odbsServer:WEIGHT)*(odbsServer:TRATE) + 
> (odbsServer:HRS)*(odbsServer:HRATE))

Have you thought about making the calc a mehod/access of your Server Class??
The above then becomes
    nTotal += odbsServer:GetTotal()

CYA
Steve


"Grant" <grantd@dunsmoreinfo.com> wrote in message 
news:1093328e-4710-4276-a0a8-0e7905c72266@r8g2000prd.googlegroups.com...
On Aug 25, 4:48 am, "Simon Goodman"
<simon.s...@spam.abersoftware.co.uk> wrote:
> Hi Grant,
>
> You can set a footer for each bBrowser column - similar to how you set
> captions - just remember to set the footer height > 0 - took a little 
> while
> to find that one. The column totals then move with the browser as you'd
> expect.
>
> To setup the bBrowser initially
> obBrowser:FooterHeight := 20
>
> For each column you want a total
> oDataColumn:FooterVisible := TRUE
>
> Set a different colour for the footers so they stand out
> oDataColumn:FooterView := bViewStyle{SELF:FooterView:Foreground,
> Brush{aBBColours[DSCAPBACK]}}
>
> Then to update the total - convert to string
> oDataColumn:Footer := Str(aTotalValues[dwFieldNo],12,2)
>
> I think thats all thats needed.
>
> HTH
>
> Simon
>
Hi Simon
I had played with the footer before without success but thanks to your
help it is working fine. I am using a loop to calculate the total:
    DO While ! EOF()
nTotal := ((odbsServer:WEIGHT)*(odbsServer:TRATE) +
(odbsServer:HRS)*(odbsServer:HRATE))
nSubTotal := nSubTotal+nTotal
skip
    ENDDO
    oColumn:Footer := nSubTotal
Then this value is displayed in a column footer. If I make a change in
any of the data fields I can't get the browser to do an immediate
update unless I exit
and reenter the page. I have put this loop into the browser following
the VirtualFieldColumn and I don't know if this is correct syntax or
not and then tried
to update the brower unsuccessfully as follows:

oDCbBrowser1:Notify(NOTIFYCOMPLETION)
      oDCbBrowser1:Recalculate()
      oDCbBrowser1:Redraw(#Footer)
      oDCbBrowser1:Refresh()
What do I need to do to cause the browser to update the footer in real
time?

Thanks again for your help.

> "Grant" wrote in message
>
> news:2847a69f-9570-469b-a092-ae0af7a594ef@p10g2000yqi.googlegroups.com...
>
> On Aug 23, 5:38 pm, "Stephen Quinn" <stevej...@bigpondSPAM.net.au>
> wrote:
>
>
>
>
>
> > Grant
>
> > What you need to do is apply the calculations to the fields in a 
> > seperate
> > function/method.
> > You could use something like the following and call it whenever you 
> > think
> > it's required
>
> > // Untested code
> > method TotalVColumn() class MyBrowser
>
> > local nVTotal AS FLOAT
>
> > SELF:Server:SuspendNotification()
> > nRecNo := SELF:Server:RecNo
> > nVTotal := 0.0
>
> > // The codeblock is the same calc you used to populate the Virtual
> > column
> > SELF:Server:Eval( {|| nVTotal += (FLD1 + FLD2) / FLD3 },,,DBSCOPEALL)
>
> > SELF:Server:RecNo := nRecNo
> > SELF:Server:ResetNotification()
> > SELF:nTotal := nVTotal // Update the total on the window/broswer
> > RETURN
>
> Hello Steve
> I have done as you suggested and it works fine to calculate the total
> but
> how do I display this total on the browser? Ideally I would like to
> have the total
> always visable at the bottom of the browser display screen.- Hide quoted 
> text -
>
> - Show quoted text -

[toc] | [prev] | [next] | [standalone]


#1872

FromJoachim Bieler <support@votools.com>
Date2011-08-24 08:04 +0200
Message-ID<9bjiieFdofU1@mid.individual.net>
In reply to#1866
Grant,

you can determine the values of the virtual field column with the access 
bVirtualFieldColumn:DataList. See topic 'bVirtualFieldColumn:DataList' in the bBrowser help for more 
information. With the following code fragment you can determine the total.

iTotal := 0
auData := oVirtualFieldColumn:DataList
iCount := oVirtualFieldColumn:DataCount
FOR iPos := 1 UPTO iCount
     iTotal += auData[iPos, BVFCD_VALUE]
NEXT

Regards,
Joachim Bieler


Am 23.08.2011 05:03, schrieb Grant:
> I would like to total the values from a VirtualFieldColumn to display
> at the end of a display but I don't know see how to do this. I have
> tried the Sum() method by using the generic virtual value #expression
> but that dosen't work so I have been looking for a sample with
> something like this but so far been unsuccessful. Any help would be
> appreciated. Thank you

[toc] | [prev] | [next] | [standalone]


#1875

From"richard.townsendrose" <richard.townsendrose@gmail.com>
Date2011-08-24 02:09 -0700
Message-ID<d389ee03-d0ba-447d-a76a-9dbc1e68bdbf@t29g2000vby.googlegroups.com>
In reply to#1872
Joachim

hows ver 4 coming along ?

on another topic, are there any "limits" to the size of the
RecordFilter array ?

we have filter numbers up to three or four thousand at the present,
and suddenly after two years some unexplained crashes on some
machines ... 5333's dont know if its my coding or what.

regards

richard

[toc] | [prev] | [next] | [standalone]


#1886

FromJoachim Bieler <support@votools.com>
Date2011-08-25 07:21 +0200
Message-ID<9bm4eiFj3dU1@mid.individual.net>
In reply to#1875
Richard,

the bBrowser does not have any limits. The only limit is the size of the dynamic memory in your 
application. Perhaps you should increase these.

Regards,
Joachim Bieler



Am 24.08.2011 11:09, schrieb richard.townsendrose:
> Joachim
>
> hows ver 4 coming along ?
>
> on another topic, are there any "limits" to the size of the
> RecordFilter array ?
>
> we have filter numbers up to three or four thousand at the present,
> and suddenly after two years some unexplained crashes on some
> machines ... 5333's dont know if its my coding or what.
>
> regards
>
> richard

[toc] | [prev] | [next] | [standalone]


#1884

FromGrant <grantd@dunsmoreinfo.com>
Date2011-08-24 15:18 -0700
Message-ID<1b8ac1e6-8e83-4c0d-9ea5-afd7b9362617@j5g2000vbk.googlegroups.com>
In reply to#1872
On Aug 23, 11:04 pm, Joachim Bieler <supp...@votools.com> wrote:
> Grant,
>
> you can determine the values of the virtual field column with the access
> bVirtualFieldColumn:DataList. See topic 'bVirtualFieldColumn:DataList' in the bBrowser help for more
> information. With the following code fragment you can determine the total.
>
> iTotal := 0
> auData := oVirtualFieldColumn:DataList
> iCount := oVirtualFieldColumn:DataCount
> FOR iPos := 1 UPTO iCount
>      iTotal += auData[iPos, BVFCD_VALUE]
> NEXT
>
> Regards,
> Joachim Bieler
>
> Am 23.08.2011 05:03, schrieb Grant:
>
>
>
> > I would like to total the values from a VirtualFieldColumn to display
> > at the end of a display but I don't know see how to do this. I have
> > tried the Sum() method by using the generic virtual value #expression
> > but that dosen't work so I have been looking for a sample with
> > something like this but so far been unsuccessful. Any help would be
> > appreciated. Thank you- Hide quoted text -
>
> - Show quoted text -

I will see if I can follow this. thank you Joachim

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web