web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to filter records that have backslash in a field using x++?

(0) ShareShare
ReportReport
Posted on by

Hi,

     I have a requirement to filter packingslip records that have backslash or no backslash in packingslipid. I could not able to filter the backslash records for the belwo code. Please let know how to filter backslash value as well no backslash value.

  this.query().dataSourceTable(tablenum(VendPackingSlipJour)).clearRanges();        

  this.query().dataSourceTable(tablenum(VendPackingSlipJour)).addRange(fieldnum(VendPackingSlipJour, PackingSlipId)).value(con2str(contPackingSlip)); 

 Thanks and Regards,

Kuppusamy S

*This post is locked for comments

I have the same question (0)
  • Verified answer
    André Arnaud de Calavon Profile Picture
    301,020 Super User 2025 Season 2 on at

    Hi Kuppisamy,

    In x++ some special characters are marked with a backslash. E.g. a return is '\n'. If the value of the packingslip contains this character you can try to add quotation marks around the query value in x++ code.

    A second attempt could be to find the position of the backslash and add a second backslash. E.g. "2013\0244" will be formatted to "2013\\0244" for the query value.

  • Verified answer
    Jonathan  Halland Profile Picture
    11,310 on at

    Hi Kuppisamy

    A couple of options for you to also look include the built in method "queryValue" to ensure that the string is properly escaped. E.G. queryRange.value(queryValue(myString));

    if you are building up your string in code you could also use a string literal e.g. value = @"2013\02\02"

  • Verified answer
    MukeshHirwani Profile Picture
    1,180 on at

    Hi,

    U can use LIKE keyword inside queryBuildRange and supply "\" OR "\\"

    mukesh-ax.blogspot.in/.../query-ranges-in-x.html

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans