Hi ,
I have below code to do the following ,
1) check if the input column type is String . If yes, do trim function and return the value
2) check if the name of the input column is Column1 or Column2. If so , padleft 8 zeroes and get rightmost 8 digits.
example : input is 1234, output should be 00001234.
input is 345 output should be 00000345.
The below code compiles without errors. But when executed it never finishes the execution it keeps running. I guess its because of the if condition not ending or something. Can you please help.
public override void Input0_ProcessInputRow(Input0Buffer Row){
foreach (PropertyInfo p in Row.GetType().GetProperties())
{
if (object.ReferenceEquals(p.PropertyType, typeof(string)))
{
p.SetValue(Row, TrimData(p.GetValue(Row, null).ToString()), null);
}
if (p.Name.Contains("column1") || p.Name.Contains("column2"))
{
p.SetValue(Row, prefixZero(p.GetValue(Row, null).ToString()));
}
}
}
public string TrimData(string ValueOfProperty)
{
ValueOfProperty = ValueOfProperty.TrimStart().TrimEnd();
return ValueOfProperty;
}
public string prefixZero(string ValueOfProperty)
{
String addzero = ValueOfProperty.PadLeft(8, '0');
ValueOfProperty = (addzero).Substring((addzero.Length - 8) + 1, 8);
return ValueOfProperty;
}
} Thanks in Advance