Page 1 of 1

xBrowse Question

Posted: Fri Aug 17, 2012 2:02 pm
by PeterHarmes
Hi,

I have an xBrowse on a DBF or SQL table and I allow the users to select multiple records (oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROWMS)

As the users select records, is there a way I can add up values in fields/columns of the selected records (or add up values of relating records in another table) and display the values in a field on the dialog?

Thanks in advance

Pete

Re: xBrowse Question

Posted: Fri Aug 17, 2012 3:33 pm
by reinaldocrespo
Peter;

The selected xbrowse record ::bKeyNo value is saved on ::aSelected property of xbrowse.

So, here is an idea:

x := 0
bAddBlock := { |nRecNo| oDbf:Goto( nRecNo ), x += oDbf:SomeValue }
AEVAL( oBrw:aSelected, { |e| EVAL( bAddBlock, e } )


Reinaldo.

Re: xBrowse Question

Posted: Tue Aug 21, 2012 3:21 pm
by PeterHarmes
Not too sure I know where in my code to put your example.

I have tried putting a calculation routine into bChange which nearly works - as you have to move after you have selected the record for the calculation/aSelected to be updated.

Any ideas where I should put my total update routine?

Pete

Re: xBrowse Question

Posted: Tue Aug 21, 2012 3:46 pm
by nageswaragunupudi
The real problem is that the calling program does not know when the user selected or deselected a row. bChange does not report this.

I suggest a new DATA bOnMultiSelect for XBrowse which will be called at the end of METHOD Select( nOption ).

You can try this modification.

Re: xBrowse Question

Posted: Tue Aug 21, 2012 3:55 pm
by PeterHarmes
Ok, I'll try that

Thanks for your help

Pete