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 Microsoft Employee

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
    Community Member Microsoft Employee 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
    RockwithNav 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
    Suresh Kulla 44,585 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
    Community Member Microsoft Employee 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
    Community Member Microsoft Employee 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
    Suresh Kulla 44,585 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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans