Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to replace VFP cursors
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 8.0
OS:
Vista
Network:
Windows XP
Database:
Jet/Access Engine
Application:
Desktop
Miscellaneous
Thread ID:
01520206
Message ID:
01520235
Views:
56
>>Succumbed ?
>
>:-}
>Doesn't take me long to get bored with lying by a pool.....
>
>>
>>
>>>What do you mean by "computes the total of a document that can contain up to a few hundred lines."
>>>What document? What computation ?

And we don't want you to be bored now do we?

So here's information that will keep you from away from the pool ? I think not :)

The document could be an order. The computation is the total invoice, the vat, the amount without vat.
The business rules are
- the client has a vat profile (you have belgian clients, EU clients or Exports, clients that are not subjected to vat .... the Belgian vat codex is quite a thick book).
- the client has an default discount
- the client has specific discounts on specific items
- the item is subjected to a specific vat rate
- some items overrule the clients discount.
- ... and here's the kicker, vat needs to be rounded up to nearest (Euro)cent.

So in my VFP inherited way, I created the ad hoc objects that implement the rules (including data access). It meant that I access multiple tables for each line of the order. Looked like a good idea as it warrants very clear and manageable code.

The problem is that my VFP days are over, I have to do this the "right" way, which would mean that I need to access the db once and then apply the rules for each line without accessing the db.

But while the order is being entered, the client wants to see the totals, the vat displayed in real time.

So I end up with the lines in a dataset.datable that is submitted to dvg. And that is the information taht i need to "join" to actual tables to get myself an ado.net datatable, that I would then scan through to compute the totals. I guess that would go faster because for say 100 lines I only would go once to the db, whereas now I'm gong like 500 times, which on an access db is (that is my assumption) kind of sllllloooowwwww.

Unless I hear anything more sexy I will implement Borislav's suggestion whereby l compile a huge sql statement (including every key) and submit that to get to my dataset.

Thanks for caring, and enjoy the pool :)

>>>
>>>>I'm looking for a way to speed up a calculation routine that computes the total of a document that can contain up to a few hundred lines. The routine is slow now because for each line I access the db. I'm looking for a way to implement this in a more data oriented way.
>>>>
>>>>In VFP I would have dumped the relevant keys into a cursor and then join the tables to the cursor in an sql statement.
>>>>
>>>>I could of course simulate this by dumping the keys into a temporary table (which if I'm right would not limit the amount of times I access the db), but I was wondering if there is not a more "elegant" way to do this.
>>>>
>>>>TIA.

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform