Page 1 of 1

Programatically binding component to data source

Posted: Thu May 20, 2010 5:49 am
by m.n
Hello,

To bind the component to data source column, one have to set a value for that component like this:

Code: Select all

component.Text.Value = "{dataSourceName.columnName}";
Is this the only way to achieve that?

Now the opposite situation - I have a component and I'd like to get information about how it is bound to data. Is there any way to get the data source name (simply a string) and the column name? Or I have to parse the value for pattern like {d*.c*}?

Programatically binding component to data source

Posted: Fri May 21, 2010 2:45 am
by Jan
Hello,
To bind the component to data source column, one have to set a value for that component like this:

Code: Select all

component.Text.Value = "{dataSourceName.columnName}";
Is this the only way to achieve that?
Sorry i don't understand. You want change text of component from report script or from code of your application?
Now the opposite situation - I have a component and I'd like to get information about how it is bound to data. Is there any way to get the data source name (simply a string) and the column name? Or I have to parse the value for pattern like {d*.c*}?
You need parse value, because each component is not linked to specified column, each component have expression which calculated by report engine.

Thank you.

Programatically binding component to data source

Posted: Fri May 21, 2010 5:40 am
by m.n
Jan wrote:Sorry i don't understand. You want change text of component from report script or from code of your application?
I'd like to implement operation like "bind specific column of data source with the component" from application code.
For text (and others except RTF and Image) component I just put "{dataSourceName.columnName}" as component value. That works very well, I just thought there is more comfortable way to do this.
Jan wrote:You need parse value, because each component is not linked to specified column, each component have expression which calculated by report engine.
Both RTF and Image components have DataColumn property, which I still have to parse for data source and column names, but it has a little different format: "dataSourceName.columnName" (i.e. without braces).

If every component would have "DataSource" and "DataColumn" properties, binding data can be easier, but currently it works and that is most important.

Thanks for your explanation.

Programatically binding component to data source

Posted: Fri May 21, 2010 8:21 am
by Jan
Hello,
I'd like to implement operation like "bind specific column of data source with the component" from application code.
For text (and others except RTF and Image) component I just put "{dataSourceName.columnName}" as component value. That works very well, I just thought there is more comfortable way to do this.
This is only way to choose column for text component.
Both RTF and Image components have DataColumn property, which I still have to parse for data source and column names, but it has a little different format: "dataSourceName.columnName" (i.e. without braces).

If every component would have "DataSource" and "DataColumn" properties, binding data can be easier, but currently it works and that is most important.
These properties exist many years. And it is very hard to change something. So, you should use them as it is.

Thank you.