Subject Re: [IBO] View, filter or ... ?
Author guido.klapperich@t-online.de
> I wonder if somebody here on the list has a better idea for the
> following problem I have:
>
> 1. I have a table with a "month,year,somedata" fields.
>
> 2. When the user starts the program he is asked about the month and
> year he wants to work with and then the whole program only works with
> that "somedata".
>
> 3. I've "solved" the problem by creating a view after he selects the
> month and data, something like
> q.sql.text:=Format('
> create view curent_table as select * from table where (month=%d) and (year=%d)',
> [cbMonth.itemindex+1,StrToInt(cbYear.items[cbYear.itemindex])]);q.execute;
> After that in the whole program I'm only reffering to the "curent"
> view. I've done this because I find easier to use "select from
> curent_table ... " than appending to all
> queries something like 'where month=... and year=..." (select from
> table where (condition) AND month=... and year=...".
>
> Note: the problem with this is that only one user could use the
> database at one time...or more users using only the selected month and
> year. In fact this is way I'm trying to find an alternative :)
>

I don't see the problem. Why can not different users work with different views ?

>
> 4. There is another way of solving this by using filters, but
> it's almost the same as the last statement.

There are several ways: Filter, Params and the SQLWhereItems


Guido