Subject Re: [IBO] Params not updating in Select + Union
Author roufusoffv
> I have these here to do some calculations based on outside
> provided by the user. I do some calculations in an OnDrawCell
> and display the results in these columns. So they are indeed
> for a grid but they do have a specific purpose. Is there some
> way to make a "calculated field" with user provided information?
> I guess I could do a SP and provide the INVOICENUM and other
> that the user controls at runtime, but I'm not sure if that has
> advantages over the OnDrawCell event.

I see two other ways that you could have a calculated field in
addition to using the OnDrawCell event, both of which were more
designed for how you're using them than the OnDrawCell method.

1) Use a parameter for your user entered information and perform
your calculations directly in your SELECT SQL. This has the
advantage that you don't need to write a stored procedure or extra
functions and its also done on the server, and everything that you
might want to update is all in once place.

It appears that your calculations are mostly simple integer
arithmatic based on a user entered row width, and if that's the case
then something like the above would work nicely. Otherwise you could
go on to:

2) Use IBO's built in calculated fields. The query has a
CalculatedFields property which can be set up with any kind of
field. You then set up an event handler much like your OnDrawCell
event handler except its called only when your data is updated and
not every time the screen repaints. If your user updates their
information without doing a refresh there is a method that you can
call that will force recalculation of the calculated fields.

Shawn Zilbert