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

  • Verified answer
    Community Member Profile Picture
    on at
    RE: How to SETFILTER for last 4 digits?

    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

  • Verified answer
    RockwithNav Profile Picture
    6,562 on at
    RE: How to SETFILTER for last 4 digits?

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

  • Suggested answer
    Suresh Kulla Profile Picture
    45,190 on at
    RE: How to SETFILTER for last 4 digits?

    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)

  • Community Member Profile Picture
    on at
    RE: How to SETFILTER for last 4 digits?

    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
    RE: How to SETFILTER for last 4 digits?

    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
    45,190 on at
    RE: How to SETFILTER for last 4 digits?

    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???

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,869 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,733 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans