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 NAV (Archived)

How to SETFILTER for last 4 digits?

(0) ShareShare
ReportReport
Posted on by

Hi,

I am developing a XMLPORT to read Credit Card information from .csv file.

For some credit cards only last four digits are available. So I want to filter my TABLE.FIELD based on these last 4 numbers.

I am trying like

TABLE.SETFILTER(FIELD, '*4[1..10]');

But its not working?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    I hope you are trying to find the records where the last four digit starts with 4, in that case you could try like this *4???

  • Community Member Profile Picture
    on at

    Thanks Suresh!

    Let me explain a bit, the field has data like this

    **** **** **** 3456

    **** **** **** 1234

    **** **** **** 9087

    **** **** **** 6754

    These preceding stars can be numbers or stars. 

    I have to filter last four places and last four places in the string can be any number.

    I am working in NAV 2017.

  • Community Member Profile Picture
    on at

    Thanks Suresh!

    Let me explain a bit, the field has data like this

    **** **** **** 3456

    **** **** **** 1234

    **** **** **** 9087

    **** **** **** 6754

    These preceding stars can be numbers or stars.

    I have to filter last four places and last four places in the string can be any number.

    I am working in NAV 2017.

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    What you want to filter for, do you want search a specific four digit number from the list if so then you can use the SETFILTER

    record.SETFILTER("Credit Card No.",'*%1', yourfourdigitvalue)

  • Suggested answer
    RockwithNav Profile Picture
    8,637 Super User 2025 Season 2 on at

    You can do a COPYSTR for last 4 digits and then do a filter om this.

  • Verified answer
    Community Member Profile Picture
    on at

    Thanks!

    this line worked for me

    TABLE.SETFILTER(FIELD_that_needed_filter , STRSUBSTNO('*%1', COPYSTR(textVariable, STRLEN(textVariable)-3, 4)))

    textvariable has values

    1. **** **** **** **** 1234

    2. **** **** **** **** 5678

    3. **** **** **** **** 2345

    4. **** **** **** **** 3466

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 NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans