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,755 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
    47,773 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
    47,773 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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics NAV (Archived)

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans