1

I have been trying to get Setfilter with wildcards working properly but i don't know why it isnt.

SETFILTER(Description,'*@%1*',"Assembly Header"."No.");

The filter does not work and does not display anything, probably because NAV is not interpreting %1 well

Jonathan Lam
  • 1,237
  • 3
  • 20
  • 49

3 Answers3

1

Found a solution, it is always better to make use of STRSUBSTNO function for wild cards concatenation

So, it do works fine

SETFILTER(Description,STRSUBSTNO('*@%1*',"Assembly Header"."No.");

:)

Jonathan Lam
  • 1,237
  • 3
  • 20
  • 49
  • As mentioned by others @ should come before * as in `'@*%1*'`. It's not mentioned in the documentation for [SETFILTER](https://learn.microsoft.com/en-us/dynamics-nav/setfilter-function--record-) but there is a table in this app docs article [Searching, Filtering, and Sorting Data](https://learn.microsoft.com/en-us/dynamics-nav-app/ui-enter-criteria-filters). – theschitz Mar 16 '20 at 16:25
0

because it's working the other way around:

SETFILTER(Description,'%1','@*' + FORMAT(Assembly Header"."No.") + '*');

so [at][star]{search term}[star]

In NAV 2013R2 it's actually gave you an error message for '*@'

Cheers!

azatoth
  • 705
  • 6
  • 14
  • You are correct about the sequence of characters but I wouldn't use + for string concatenation in that case. If you experience issues with just `SETFILTER(Description, '@*%1*', "Assembly Header"."No.");` which I've seen in some versions (can't remember which tho) I would say that `SETFILTER(Description, STRSUBSTNO('@*%1*', "Assembly Header"."No."));` is the way to go. `FORMAT` should not be needed since the value parameter for both `STRSUBSTNO` and `SETFILTER` is _any_. – theschitz Mar 16 '20 at 16:16
0

The only solution working for me in NAV 2018 was that of azatoth:

'*@....' not working

'@*....' working

  • Then please upvote that answer or comment on it. Don't copy stuff over, especially if there is an accepted answer – Nico Haase Apr 19 '18 at 09:30