Subject | Re: add an item to ib_lookupcombo |
---|---|
Author | radevojvodic |
Post date | 2003-11-04T08:04:33Z |
I think that the question was how to get all products. I supose that
you have a query that looks like this:
Select PRODUCT_NAME From Products
Where PRODUCT_ID LIKE :PARAM_PRODUCT
If you choose a value from combobox and assign it to :PARAM_PRODUCT
via ParamByName() Property it will work OK. The trick is that you can
assign value like this: IBO_Query.ParamByName
('PARAMPRODUCT').AsString := LookupCombo.Items[ItemIndex] + '%' then
if you left LookupCombo empty your parameter wil be '%' and the
select statement will actually look like
Select PRODUCT_NAME From Products
Where PRODUCT_ID LIKE '%' and that's what you want.
you have a query that looks like this:
Select PRODUCT_NAME From Products
Where PRODUCT_ID LIKE :PARAM_PRODUCT
If you choose a value from combobox and assign it to :PARAM_PRODUCT
via ParamByName() Property it will work OK. The trick is that you can
assign value like this: IBO_Query.ParamByName
('PARAMPRODUCT').AsString := LookupCombo.Items[ItemIndex] + '%' then
if you left LookupCombo empty your parameter wil be '%' and the
select statement will actually look like
Select PRODUCT_NAME From Products
Where PRODUCT_ID LIKE '%' and that's what you want.
--- In IBObjects@yahoogroups.com, "james_027" <james_027@y...> wrote:
> Here is my technique. I will use a TStringlist and put some value
> correspond with the ib_lookupcombo. For example if you have the
> following items in your ib_lookupcombo ...
>
> ALL PRODUCTS (which is equal to 0)
> MILK (which is equal to 1)
> JUICE (which is equal to 2)
> MINERAL WATER (which is equal to 3)
>
> first I will declare the variable like this
>
> var
> itemvalue: tstringlist;
>
> second i will put some value;
>
> itemvalue:=tstringlist.create;
> itemvalue.commatext:='0,1,2,3';
>
> please refer to delphi help on how to use the tstringlist.commatext
> properties.
>
> So if you choose the MILK if will return the value 1 right? Is that
> what you mean?
>
> you will need this to get the value 2
>
> itemvalue[ib_combobox.itemindex];
>
> then just put a condition if all products are selected
>
> if itemvalue[ib_combobox.itemindex] = 0 then
> select all product
> else
> select product base on the select item in the combobox
>
>
> hope this will help you
>
>
> --- In IBObjects@yahoogroups.com, "m_kavcic" <m_kavcic@y...> wrote:
> > Hello everyone,
> >
> > I am doing reports and would like to add an item at the beginning
> > to lookupcombo to select all products.
> >
> > Like this:
> > 0, all products (added item)
> > 1, milk
> > 2, juice
> > 3, mineral water ...
> >
> > How can I do that?
> >
> > Thanks, Marko