FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse Multi-Select (bookmarks )
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
xBrowse Multi-Select (bookmarks )
Posted: Wed Mar 25, 2015 05:57 PM
Rao

I have some code that uses Multi-Select and I want to be able to total the Balance of the selected rows. I am using this code ( please forgive the debug info ) that loops thru the Len of aCols.

When I select multiple lines ( in this case 2 lines ) I see two bookmark records ( 141 and 288 ), however the For\Next Loop only sees the current ( last ) Bookmark 288 and loops thru twice adding up the same record twice.

Please look over this code and tell me what I am doing wrong. It appears that oLbxB:BookMark(aCols[i]) goes to the last row selected ( bookmark 288 ) and since the len of aCols = 2 .. it adds the same row twice and 80.08 gets added twice not taking into consideration bookmark 141.

Somehow, I need to be able to loop thru both bookmarks ( top to bottom ) and add the balance of the two records.

Rick Lipkin

Code (fw): Select all Collapse
nTotal   := 0.00
nPayment := 0.00
nBal     := 0.00
aCols    := oLbxB:aSelected

xbrowse(aCols )

msginfo( "Len aCols" )
msginfo( Len(aCols ))

For i := 1 to Len(aCols)

    msginfo( "i" )
    msginfo( i )

    oLbxB:BookMark(aCols[i])

    msginfo( "BookMark" )
    msginfo( oLbxB:BookMark(aCols[i]))

    msginfo( "Invoice Balance" )
    msginfo( oRsInvoice:Fields("Balance"):Value )

    nBal := nBal+oRsInvoice:Fields("Balance"):Value
Next

msginfo( "nBal")
msginfo( nBal )


Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: xBrowse Multi-Select (bookmarks ) - Solved
Posted: Wed Mar 25, 2015 06:16 PM
To All

Doing a quick search thru thru forum .. I see how to goto the bookmark record I wish to loop thru... this change was the key:

Code (fw): Select all Collapse
oLbxB:BookMark := (aCols[i])


Rick Lipkin

Continue the discussion