Hello, I would like to know how to check if values in an excel sheet exist in the database. In my case, if the values in the “Item Code” column in the sample sheet match those given in the master sheet. Anyone has an idea?
Master sheet:
mastersheet.xlsx (8.4 KB)
Sample sheet:
samplesheet.xlsx (8.5 KB)
@thedriedseaweed88
dt1.AsEnumerable.where(Function(a) dt2.AsEnumerable.Any(Function(b) b(“Item Code”).ToString.Trim.Equals(a(“Item Code”).ToString.trim))).CopyToDataTable
gives you all the rows which are matched in both the tables
if you want to excute the query you try this way,Follow the steps Provided in below reply
and use the below expression for Your Query
StrQuery=“select * From YourTableName where {0}=‘{1}’”
string.format(StrQuery,YourColumnName,YourValue)
Anil_G
(Anil Gorthi)
November 10, 2023, 7:19am
3
@thedriedseaweed88
You can use a select query inside for each row in datatable and then in where condition give the item code
Flow looks like this
For each row in datatable for sample sheet
Inside loop use run query and use select query as below
"Select * From TableName where [ColumnName]='" + currentRow("ColumnName").ToString + "'"
And in the output check output.Count>0 using if condition…on then side row is found and on else its not found
Cheers
Hello, I am still not very sure what that means. Would you mind providing a xaml file? Thanks
Hello, I am still not very sure if I’m doing it right. Would you mind providing a xaml file or replacing the line you wrote with my header names? Thank you
Anil_G
(Anil Gorthi)
November 10, 2023, 9:39am
6
@thedriedseaweed88
please check this
"Select * From TableName where [Item Code]='" + currentRow("Item Code").ToString + "'"
cheers