I have a dataset containing a product.
I have a list of possible values the product can start with. Values may be added and removed from the asset over time so the number of values is not fixed.
The values in de list can vary in length but the product always starts with the value.
right now I have it hard coded.
dtsOutputLocaties.Tables(0).AsEnumerable().Where(
Function(r) r(“product”).ToString().ToUpper().StartsWith(“BG DAG”) Or
r(“product”).ToString().ToUpper().StartsWith(“DA LG”) Or
r(“product”).ToString().ToUpper().StartsWith(“DA OUD”) Or
r(“product”).ToString().ToUpper().StartsWith(“DA VG”) Or
r(“product”).ToString().ToUpper().StartsWith(“DAGBESTEDING”) Or
r(“product”).ToString().ToUpper().StartsWith(“DB”) Or
r(“product”).ToString().ToUpper().StartsWith(“FZ-DB”) Or
r(“product”).ToString().ToUpper().StartsWith(“DAGBEHANDELING”)
).CopyToDataTable()
I want to put the list in an asset so i can extract it as a List<> or Array<> and am looking for a way to compare the product (starts with) to this dynamic list. Ideas are very welcome.
Store the prefixes in an Orchestrator asset (Text or JSON) and load them into a List(Of String).
Then replace all hard-coded StartsWith checks with Any:
Store the prefixes in an Asset as a newline- or comma-separated string, convert it to a List(Of String), and filter with Any, e.g.
dtsOutputLocaties.Tables(0).AsEnumerable().
Where(Function(row) startValues.
Any(Function(value) row(“product”).ToString().
ToUpper().StartsWith(value.ToUpper()))).
CopyToDataTable()