To Reorder Rows based on Array data value

Hello Team,

Based on Array That we have
OutputDt = { IN1 , IN2 , IN3 , INa , INb , INc , YNc}

How can we rearrange below

EX_dt =
image

Into Final dt as Below
After organizing according to OutputDt (Values match E_No data)

image

Have attached Excel For Reference Test Data
Sheet 2 = Original Data Format
Sheet 1 = Is the Excepted Format that we need to achieve using OutputDt

Test Data Original and Final Format.xlsx (6.9 KB)

Thanks Team in advance

@NISHITHA

try this once

OutputDt={ “IN1”, “IN2”, “IN3”, “INa”, “INb”, “INc”, “YNc” }

dt.AsEnumerable.OrderBy(Function(a) array.IndexOf(OutputDt,a(0).tostring)).CopyToDataTable
1 Like

Thanks @Shiva_Nikhil For the quick resolution

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.