Column value from index

Stimulsoft Reports.NET discussion
Post Reply
deestinee
Posts: 11
Joined: Tue Dec 17, 2019 7:26 am

Column value from index

Post by deestinee »

Hello,

I´m trying to get a value from column by index, but it is not working.
public void txt_GetValue(object sender, Stimulsoft.Report.Events.StiGetValueEventArgs e)
{
e.Value = ToString(sender, Data.Columns.ToString(), true);
}

If I call this, only column name will appear in databand, I also tried this:

public void txt_GetValue(object sender, Stimulsoft.Report.Events.StiGetValueEventArgs e)
{
e.Value = ToString(sender, Data.Rows[0].ToString(), true);
}

But this time the rows in databand are the same (containing the same value).

If I call this:
public void txt_GetValue(object sender, Stimulsoft.Report.Events.StiGetValueEventArgs e)
{
e.Value = ToString(sender, Data.Col1, true);
}
It is working, but I need to specify the column index, because columns are added dynamically.
Could youe help me?

Thank you. Filip
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Column value from index

Post by Lech Kulikowski »

Hello,

Please check the following expression:
{DataSourceName.DataTable.Rows[RowIndex][ColumnIndex]}
or
{DataSourceName.DataTable.Rows[RowIndex]["ColumnName"]}

Thank you.
deestinee
Posts: 11
Joined: Tue Dec 17, 2019 7:26 am

Re: Column value from index

Post by deestinee »

Hello,

It did not work. In databand it is showing same value in all rows.
I had to use system variable Line and Column. Then increment the Column variable.

Code: Select all

public void txt_GetValue(object sender, Stimulsoft.Report.Events.StiGetValueEventArgs e)
{
	e.Value = ToString(sender, Data.DataTable.Rows[Line-1][Column-1], true);
	Column ++;	
}
Thank you!
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Column value from index

Post by Lech Kulikowski »

Hello,

Please send us a sample report with test data that reproduces the issue for analysis.

Thank you.
deestinee
Posts: 11
Joined: Tue Dec 17, 2019 7:26 am

Re: Column value from index

Post by deestinee »

Hello,

I have another question. I would like to get a total sum of all dynamically added columns. Is it possible to use Text_Sum.CalcItem(Data.Column) with column index? I mean something like: Text_Sum.Calcitem(Data.Column[1]).
Thank you.
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Column value from index

Post by Lech Kulikowski »

Hello,

It is difficult to say something without a sample report.
Please send us a sample report with test data that reproduces the issue for analysis.

Thank you.
Post Reply