Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.Order and .Browse

Status
Not open for further replies.

iwells

Programmer
Oct 2, 2012
284
CA
Hi,

Fairly simple question that I want confirmation on, if I .Order a view then follow with a Do loop that where the first statement is a .Browse, does the view retain the order even after every .Browse or does the .Order need to be in the Do loop? For example I have scenario A, but want to make sure I shouldn't be doing scenario B

Scenario A

if view.fetch = true then

view.order = x​

do​

view.browse strBrowse, True

loop while.fetch = true​

End if

Scenario B

if view.fetch = true then

do​

view.order = x​
view.browse strBrowse, True​
loop while view.fetch = true​

End if
 
Rule of thumb: set .Order and .Browse before you .Fetch
In other words don't set .Order or .Browse in your loop.


Sage 300 Certified Consultant
 
And if you .Update then you need to reset your .Browse
And, if .Order <> 0 then set .Order = 0 before you .Update/.Insert the transaction.
And, if your .Update affects any field within your .Key you have to be very careful.

Sometimes when I need to process transactions in an alternate order I create a disconnected ado recordset and .fetch the records into the recordset. Then I can sort the disconnected recordset in any fashion without worrying about my Sage views. If I've been a good programmer then I hold the primary key for the records in my recordset so when I access the Sage records I can set .Order to 0 and use .Read instead of .Browse.
 
I try to never .Update and .Browse on the same view. I .Browse on a read-only version, then .Read the read-write version from the keys of the read-only.

Sage 300 Whisperer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top