Table of Contents

Class FieldSearch

Namespace
Dynamicweb.Ecommerce.Orders
Assembly
Dynamicweb.Ecommerce.dll

Represents a single field-level filter for use with FieldSearches.

public record FieldSearch : IEquatable<FieldSearch>
Inheritance
FieldSearch
Implements
Inherited Members

Constructors

FieldSearch(string, string, IReadOnlyList<string>)

Represents a single field-level filter for use with FieldSearches.

public FieldSearch(string FieldName, string Operator, IReadOnlyList<string> Values)

Parameters

FieldName string

The EcomOrders column name to match, e.g. OrderCustomerCountryCode.

Operator string

One of: eq (equals), in (set membership), like (contains, maps to SQL LIKE '%value%').

Values IReadOnlyList<string>

One or more values. For eq and like only the first value is used. Multiple values for in are pipe-separated when parsed from a query string, e.g. DK|DE|SE.

Properties

FieldName

The EcomOrders column name to match, e.g. OrderCustomerCountryCode.

public string FieldName { get; init; }

Property Value

string

Operator

One of: eq (equals), in (set membership), like (contains, maps to SQL LIKE '%value%').

public string Operator { get; init; }

Property Value

string

Values

One or more values. For eq and like only the first value is used. Multiple values for in are pipe-separated when parsed from a query string, e.g. DK|DE|SE.

public IReadOnlyList<string> Values { get; init; }

Property Value

IReadOnlyList<string>

Methods

GetSearchableFieldNames()

Gets the field names that can be used as FieldName: the searchable EcomOrders columns plus the custom order fields registered on the solution.

public static IReadOnlySet<string> GetSearchableFieldNames()

Returns

IReadOnlySet<string>

A case-insensitive set of field names.

TryParse(string?, out IReadOnlyList<FieldSearch>?)

Parses one or more semicolon-separated tokens of the form fieldname<op>value into a list of FieldSearch instances, skipping the tokens that cannot be parsed.

public static bool TryParse(string? raw, out IReadOnlyList<FieldSearch>? fieldSearches)

Parameters

raw string

A single token such as OrderCustomerCountryCode<eq>DK, or multiple tokens separated by ;, e.g. OrderCurrencyCode<eq>EUR;OrderPaymentMethod<in>STRIPE|KLARNA.

fieldSearches IReadOnlyList<FieldSearch>

The parsed list when successful; null otherwise.

Returns

bool

true if at least one valid token was parsed; otherwise false.

TryParse(string?, out IReadOnlyList<FieldSearch>?, out IReadOnlyList<string>)

Parses one or more semicolon-separated tokens of the form fieldname<op>value into a list of FieldSearch instances, reporting the tokens that cannot be parsed instead of skipping them.

public static bool TryParse(string? raw, out IReadOnlyList<FieldSearch>? fieldSearches, out IReadOnlyList<string> invalidTokens)

Parameters

raw string

A single token such as OrderCustomerCountryCode<eq>DK, or multiple tokens separated by ;, e.g. OrderCurrencyCode<eq>EUR;OrderPaymentMethod<in>STRIPE|KLARNA.

fieldSearches IReadOnlyList<FieldSearch>

The parsed list when every token was valid; null otherwise.

invalidTokens IReadOnlyList<string>

The tokens that carry no recognized operator, no field name or no value. Empty when all tokens were valid.

Returns

bool

true if at least one token was parsed and none were invalid; otherwise false.

To top