# Presets with wildcards

**URL:** <https://forum.genieacs.com/t/presets-with-wildcards/903>\
**Category:** Uncategorized\
**Created:** [July 21, 2020, 1:25pm UTC](https://forum.genieacs.com/t/presets-with-wildcards/903 "2020-07-21T13:25:16Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![wariator](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@wariator](https://forum.genieacs.com/u/wariator)\
**Post date:** [July 21, 2020, 1:25pm UTC](https://forum.genieacs.com/t/presets-with-wildcards/903/1 "2020-07-21T13:25:16Z")

</div>

Can i use presets by precondition product class with wildcard like that: “My-Model-\*”? If yes, what syntax?

_My preset1 not working:_

> Product class = My-model  
> Product class = My-model-revision-A1

_My preset2 it`s working:_

> Product class = My-model-revision-A  
> Product class = My-model-revision-C  
> Product class = My-model-revision-B

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [July 21, 2020, 6:25pm UTC](https://forum.genieacs.com/t/presets-with-wildcards/903/2 "2020-07-21T18:25:15Z")

</div>

It would help to know what version of GeneiACS you are using…

---

<div class="post-metadata">

**Author:** ![wariator](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@wariator](https://forum.genieacs.com/u/wariator)\
**Post date:** [July 22, 2020, 6:16am UTC](https://forum.genieacs.com/t/presets-with-wildcards/903/3 "2020-07-22T06:16:10Z")

</div>

GenieACS v1.1.3 Dockerfile

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [July 22, 2020, 3:51pm UTC](https://forum.genieacs.com/t/presets-with-wildcards/903/4 "2020-07-22T15:51:21Z")

</div>

To the best of my knowledge this isn’t possible with v1.1. In v1.2 the query/matching syntax has changed to be more SQL like and you might be able to do LIKE syntax. But we haven’t upgraded to v1.2 yet so I cannot offer any help on that.

-dan

---

<div class="post-metadata">

**Author:** ![wariator](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@wariator](https://forum.genieacs.com/u/wariator)\
**Post date:** [July 23, 2020, 6:25am UTC](https://forum.genieacs.com/t/presets-with-wildcards/903/5 "2020-07-23T06:25:19Z")

</div>

Sounds intresting. But using mongoDB or it’s change with new version to sql? What DB using with new version?

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [July 23, 2020, 4:52pm UTC](https://forum.genieacs.com/t/presets-with-wildcards/903/6 "2020-07-23T16:52:20Z")

</div>

We haven’t switched yet so I haven’t dug into that.

---

<div class="post-metadata">

**Author:** ![gittela](https://avatars.discourse-cdn.com/v4/letter/g/e36b37/32.png) [@gittela](https://forum.genieacs.com/u/gittela)\
**Post date:** [July 29, 2020, 7:05am UTC](https://forum.genieacs.com/t/presets-with-wildcards/903/7 "2020-07-29T07:05:30Z")

</div>

Still mongodb, it’s just the query-language that has been expanded. With my limited knowledge (I don’t really know programming or SQL but I can google and we have akcoder on the forum…) we use it like this:

Find a unit that begins with Nokia:  
`InternetGatewayDevice.DeviceInfo.ProductClass LIKE "Nokia%"`  
Find a unit that contains Nokia:  
`InternetGatewayDevice.DeviceInfo.ProductClass LIKE "%Nokia%"`  
Find a unit that ends with Nokia:  
`InternetGatewayDevice.DeviceInfo.ProductClass LIKE "%Nokia"`

Here’s an OR example:  
`InternetGatewayDevice.DeviceInfo.ModelName LIKE "%DRG719%" OR InternetGatewayDevice.DeviceInfo.ModelName LIKE "%DRG711%" OR InternetGatewayDevice.DeviceInfo.ModelName LIKE "%v2%"`

One can also group conditions:  
`(Device.DeviceInfo.ProductClass = "Polar" OR Device.DeviceInfo.ProductClass = "Lunar") AND Tags.bridge IS NULL AND Tags.iptv IS NULL AND Tags.get IS NOT NULL AND Tags.nat IS NOT NULL AND Device.DeviceInfo.ModelName <> "FiberTwist-P2410"`

---

<div class="post-metadata">

**Author:** ![wariator](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@wariator](https://forum.genieacs.com/u/wariator)\
**Post date:** [July 29, 2020, 2:49pm UTC](https://forum.genieacs.com/t/presets-with-wildcards/903/8 "2020-07-29T14:49:22Z")

</div>

Where are you using it? It’s not working for Presets.

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [July 29, 2020, 5:12pm UTC](https://forum.genieacs.com/t/presets-with-wildcards/903/9 "2020-07-29T17:12:15Z")

</div>

You need to be on v1.2 to get the SQL like syntax.

---

<div class="post-metadata">

**Author:** ![zaidka](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/zaidka/32/9_2.png) [@zaidka](https://forum.genieacs.com/u/zaidka)\
**Post date:** [July 30, 2020, 1:30am UTC](https://forum.genieacs.com/t/presets-with-wildcards/903/10 "2020-07-30T01:30:57Z")

</div>

Not a very elegant solution, but you could use a pair of ‘greater than’ and ‘less than’ conditions to simulate a ‘starts with’ condition:

```
Product class >= My-model
Product class < My-model-ZZZ
```

---

<div class="post-metadata">

**Author:** ![wariator](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@wariator](https://forum.genieacs.com/u/wariator)\
**Post date:** [July 30, 2020, 6:02am UTC](https://forum.genieacs.com/t/presets-with-wildcards/903/11 "2020-07-30T06:02:11Z")

</div>

But this compares the length only. The comparison will work for and “Your-model” too. Is’n it?

---

<div class="post-metadata">

**Author:** ![zaidka](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/zaidka/32/9_2.png) [@zaidka](https://forum.genieacs.com/u/zaidka)\
**Post date:** [July 30, 2020, 6:06am UTC](https://forum.genieacs.com/t/presets-with-wildcards/903/12 "2020-07-30T06:06:47Z")

</div>

Not length. Strings are compared alphanumerically.
