I’ve provided a screenshot of two queries. 1. If the column c range contains more than 100% (highlighted in yellow), the result should be “Pass,” otherwise “Fail.”
2. If Column G has all hypens as seen in the screenshot, it should display “Fail,” else “Pass.”
(From row in dt.AsEnumerable.Skip(1)
Let result = If(Cdbl(row(2).ToString.Replace("%","")) > 100.00,"Pass","Fail")
Select result).ToArray
In Query - 1, we first go through each row except the 1st since it contains text like market price and so on. Then we remove the % at end and check if its greater 100%, if its then we set result as Pass else Fail. This will generate a set of values for each row as pass or fail that is converted to an array of string
In Query - 2, we use an if condition to check whether all rows contain ‘-’ or not. The All function returns a boolean value that all rows in column G are hypen or not. If it results in True (i.e column G contains only hypens) then the output variable is set to False, else it is set to True. Output Variable is of type String
Note:- To execute this query, dt is the excel datatable used after read workbook
(From row in dt.AsEnumerable.Skip(2)
Let result = If(Double.TryParse(row(2).ToString,Cdbl(row(2).ToString,0) > 1,"Pass","Fail")
Select result).ToArray
Or
(From row in dt.AsEnumerable.Skip(2)
Let value = If(Double.TryParse(row(2).ToString,Cdbl(row(2).ToString ,0), Cdbl(row(2),0)
Let result = If(value > 1,"Pass","Fail")
Select result).ToArray
(From row in dt.AsEnumerable.Skip(2)
Let result = If(Double.TryParse(row(2).ToString,Cdbl(row(2).ToString),0) > 1,"Pass","Fail")
Select result).ToArray