Hello, I have a custom userAttribute.name in MSP 3.3.1. This value can contain the following: MC01_100000 Thru MC20_899999 Obviously these are NOT numerical, but string data. How could I create a filter to show all values between: MC01_100000 and MC20_499999 Also, the prefix of MCXX_, is not pertinent, just six chars following the underscore is pertinent data for this filter or policy narrowing. Thanks Brad
Device Saved Filters |
2 Replies
Rudra, Actually, I needed to surround the underscore with hard brackets. I wasn't aware that an underscore to a SQL query is like a wildcard as well. For the underscore to be taken literally in the LIKE query it needs to be bracketed. %[ _ ]1% Shown with spaces, for clarity. Thanks Brad
Hello Brad,
The Rules in provisioning and device saved filter like LESS THAN and GREATER THAN are only applied for numerical(FLOAT) data so you cannot use them.
But you could use the LIKE functionality in the Rules.
As per your requirement you wanted to get the list of devices having
userAttribute.name between MC01_100000 and MC20_499999
ignoring the MC01 and MC 20 in between. So you want the list of devices having
100000
100001
100002
and so on
till 499999
So you can use filters in this way:
userAttribute.name like %_1%
OR
userAttribute.name like %_2%
OR
userAttribute.name like %_3%
OR
userAttribute.name like %_4%
The percent(%) character will match one or more characters in your device values.
So
userAttribute.name like %_1%
will give you all values like:
100000
100001
and so on
userAttribute.name like %_2%
will give you all values like:
200000
200001
and so on.
Hope this helps.