USING A DINAMIC DATASOURCE DEPENDING SELECTEDKEY OF OBJECT LOOKUPBOX

Stimulsoft Reports.NET discussion
Post Reply
Saus86
Posts: 62
Joined: Fri Mar 23, 2012 10:57 am
Location: Italy

USING A DINAMIC DATASOURCE DEPENDING SELECTEDKEY OF OBJECT LOOKUPBOX

Post by Saus86 »

Hi

I use in StiForm two LookupBox, in Lookupbox1 i have loaded a DataSourceA and i set from interface in field (DataBindings) in Items a column and in Keys another column of my DataSourceA. This DataSourceA have property Connect on Start=True.



In the LookupBox2 i want load a "dinamic" DataSourceB i.e. its content changes according to the value selected from Lookupbox1 (changing
query of this DataSourceB) Is Possibile??
I have try to set property Item and Keys of Lookupbox2 not from interface but in code writing in event LOadForm...

(AskBOMforItem is LookupBox2 and SelectionsBOMFilter the DataSource)
...
this.AskBOMforItem.ItemsBinding = "SelectionsBOMFilter.Voice";
this.AskBOMforItem.KeysBinding = "SelectionsBOMFilter.IdERP";
...
But this 2 command no function.... (this 2 command function only in section "InitializeComponent")

Then (inside event SelectedIndexChanged of Lookupbox1 ) i want know how modify SqlCommand of DataSourceB and rebinding this contents
in property Item and Keys of Lookupbox2!!!


Thanks :)
Saus86
Posts: 62
Joined: Fri Mar 23, 2012 10:57 am
Location: Italy

USING A DINAMIC DATASOURCE DEPENDING SELECTEDKEY OF OBJECT LOOKUPBOX

Post by Saus86 »

But this 2 command no function.... please help me
Thanks;)
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

USING A DINAMIC DATASOURCE DEPENDING SELECTEDKEY OF OBJECT LOOKUPBOX

Post by HighAley »

Hello.
Saus86 wrote:I use in StiForm two LookupBox, in Lookupbox1 i have loaded a DataSourceA and i set from interface in field (DataBindings) in Items a column and in Keys another column of my DataSourceA. This DataSourceA have property Connect on Start=True.



In the LookupBox2 i want load a "dinamic" DataSourceB i.e. its content changes according to the value selected from Lookupbox1 (changing
query of this DataSourceB) Is Possibile??
I have try to set property Item and Keys of Lookupbox2 not from interface but in code writing in event LOadForm...

(AskBOMforItem is LookupBox2 and SelectionsBOMFilter the DataSource)
...
this.AskBOMforItem.ItemsBinding = "SelectionsBOMFilter.Voice";
this.AskBOMforItem.KeysBinding = "SelectionsBOMFilter.IdERP";
...
But this 2 command no function.... (this 2 command function only in section "InitializeComponent")

Then (inside event SelectedIndexChanged of Lookupbox1 ) i want know how modify SqlCommand of DataSourceB and rebinding this contents
in property Item and Keys of Lookupbox2!!!
Please, send us your report template with data for analysis.

Thank you.
Saus86
Posts: 62
Joined: Fri Mar 23, 2012 10:57 am
Location: Italy

USING A DINAMIC DATASOURCE DEPENDING SELECTEDKEY OF OBJECT LOOKUPBOX

Post by Saus86 »

Problem Resolved...thank you anyway!!

i have used a DataSourceA binded in a LookUpBox (AskItem) and i use another DataSourceB (SelectionsBOMFilter) using property: Next() First eof ecc.. for acces datas. Then i use a StiComboboxcontrol (AskBOMItem) for insert inside the items of DataSourceB. All this according to the value of a condition.

Below the example

i insert this code in event Selectindexchanged of Lookupbox "AskItem"

int length=SelectionsBOMFilter.Rows.Count;
this.AskBOMItem.Control.Items.Clear();

int row=0;
bool PresenceBOM=false, FirstElementBOM=true;
SelectionsBOMFilter.First();
//while (!SelectionsBOMFilter.IsEof)
while (row<length)
{
if (this.SelectionsBOMFilter.IdItem==System.Convert.ToInt64(AskItem.SelectedKey))
{
this.AskBOMItem.Control.Items.Add(SelectionsBOMFilter.Voice);
if(FirstElementBOM)
{
//metto nel parametro il codice IdBOM della prima BOM che trovo per quell Item
ParamIdBOM=SelectionsBOMFilter.IdBOM;
FirstElementBOM=false;
this.Parametro.Text=""+ParamIdBOM;
}
PresenceBOM=true;
}
SelectionsBOMFilter.Next();
row++;
}
if(!PresenceBOM)
{
this.AskBOMItem.Control.Items.Add("Nessuna Distinta associata");
ParamIdBOM=-1;
this.Parametro.Text =System.Convert.ToString(ParamIdBOM);
}
this.AskBOMItem.SelectedIndex = 0;

I hope it's useful to someone
Thanks
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

USING A DINAMIC DATASOURCE DEPENDING SELECTEDKEY OF OBJECT LOOKUPBOX

Post by HighAley »

Hello.

Thank you for solution of the problem.
Post Reply