Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Unanswered

How to set a filter with a value containing "&" in Business Central?

(1) ShareShare
ReportReport
Posted on by 6

Hi everyone,

I'm working with Microsoft Dynamics 365 Business Central and I need to set a filter on the industry field where the value is "Oil & Gas" (as a single string). However, when I try to set the filter, Business Central interprets "Oil" and "Gas" as two separate values because of the special character and I get the following error:

"The filter 'Oil & Gas' is not valid for the Industry field on the Customer table. 'Oil' is not an option."

Here is what I'm trying to do:

xValueString := jtoken.AsValue().AsText();  //here xValueString := 'Oil & Gas';
Customer.SetFilter(industry, Format(xValueString));

But it seems like it splits the value into two parts: "Oil" and "Gas", rather than considering them as one value.

Is there a way to properly set this filter so that "Oil & Gas" is treated as a single value, without splitting on the & character?

Any help would be appreciated!

Thanks in advance.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,387 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans