kaurM
October 11, 2023, 6:12pm
1
Hello All,
Can someone help me read the value highlighted in below excel. The names of the month will vary every month and the row header on the left is “Sum.ChangeValue” is not on a fixed row. It can also vary.
The row where the value lies is not the last row, it comes in the middle somewhere.
Is there a way to achieve this?
Thanks,
@kaurM
is the cell is always fixed in that F column?
or everytime will get the values in the last column for month and total ?
kaurM
October 11, 2023, 6:23pm
3
Hi,
It will always be the last column, for every new month a new column will get added at the last.
Thanks,
@kaurM
then you can follow this steps
index=dt.columns.count
rowscount=dt.rows.count
use
assign activity
variable1=dt.rows(0)(index-1) gives monthvalue
for total use another assign activity
variable2=dt.rows(rowscount)(index-1)
for the sum.change value
variable3=dt.rows(rowscount)(0)
cheers
kaurM
October 11, 2023, 6:31pm
5
Thanks for your response. The row where the value lies is not the last row actually, it comes in the middle somewhere. Sorry my bad, I didn’t post the full screenshot because of the data sensitivity.
PS I updated my question as well.
@kaurM
ok no issues
isthe name sum.ChangeValue is fixed ?,if so
use find/replace activity to find the cell address
or you can use this expression to get the row index
dt.AsEnumerable.ToList.FindIndex(Function(x) x(“ColumnName”).tostring.equals(“Sum.ChangeValue”))
dt.AsEnumerable.ToList.FindIndex(Function(x) x(0).tostring.equals(“Sum.ChangeValue”))
cheers
Hi @kaurM ,
Could you maybe check with the below Expression :
DT.AsEnumerable.Where(Function(x)x(0).ToString.Equals("Sum.ChangeValue")).Select(Function(x)x(DT.ColumnCount-1).ToString).FirstOrDefault
Here, DT
is the Datatable variable.
Also, assuming that Sum.ChangeValue
is always in the First Column and the value to fetch from that row is always in the last column.
The above Expression provides Null as Output if there are no values that match the condition.
kaurM
October 11, 2023, 6:53pm
8
Thanks so very much It worked perfectly.
1 Like
system
(system)
Closed
October 14, 2023, 6:53pm
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.