Searching for Licenses using Linq Queries
Sorting by ID
If you happen to know the ID of a license key, it can easily be found. You can use relation operators too. These are just some of the examples:
id=2- One key where id is equal to 2.</li>
id=3- Two keys, one with id set to 2 and another with id set to 3.
id < 10- Keys where id is less than 10. Here, we will get 9 keys. You can also change to
id <= 10to get 10 keys (using less than or equal to operator).
Sorting by Key
Let’s say that you want to look at a license (or several licenses) with a certain key string (in Key column). Below, some of the examples:
key="ITVBC-GXXNU-GSMTK-NIJBT"- One license key (if exists).
key.contains("ITVBC")- All keys that contain “ITVBC”.
Sorting “Created” and “Expires”
Say you want to look at licenses that were created at a certain point in time or that will expire at a given date. Or, maybe you are interested in a certain interval, for instance keys created a yesterday or a month ago. Here are some examples:
created = today- Keys created today only.
created >= yesterday- Keys created today and yesterday. We could also type
created = today or created = yesterday.
created >= DateTime(2015,01,01)- Keys that were created in the beginning of 2015.
expires <= DateTime(2016,01,01)- Keys that will expire no later than the beginning of 2016.
In addition, you can use variables such as
Sorting by “Period”
If you choose to have a time limited license, such as those that are used in a subscription, the period becomes important. You can sort keys based on the period as follows:
period = 30- Keys that have a period equal to 30.
Sorting features “F1,…, F8”
Features can be sorted also. Note, although features are represented as 1’s and 0’s, these are actually referring to a Boolean type, i.e. True or False.
F1 = true- Keys that have feature1 set to true (or 1 on the product page).
Searching The Notes Field
Notes field can be sorted in a similar way as Key (see above). Here are some of the examples.
notes="Bob"- Keys where Notes is equal to “Bob”
notes.contains("to Bob")- Keys where Notes contains “to Bob”
Sorting by Block
Block can be sorted similar to Features. “Yes” and “No” refer to the Boolean values “True” and “False”, respectively.
block=true- Keys that are blocked (block=yes/true).
Sorting based on Customer
A customer object has four fields that can be used when sorting licenses.
- Id - (a number, similar to ID field sorting).
- Name - (a string, similar to notes field sorting).
- Email - (a string, similar to notes field sorting).
- CompanyName - (a string, similar to notes field sorting).
- Created - (a date, similar to Created field sorting).
Here are some sample queries:
customer.name="Bob"- Keys where the Customer’s name is “Bob”
customer.id=3- Keys where where Customer’s id is 3.
customer.created= today- Keys where the Customer’s creation date is set to today.
Sorting based on Activated Devices
The Activated Devices (aka Activated Machines) is stored as a list of elements that contain three fields:
- Mid - (machine code of the device)
- IP - (the IP address of the device during activation)
- Time - (the date and time of the activation)
There are several useful parameters that can be retrieved using a query:
Find license keys that have activated devices
ActivatedMachines.Count() > 0- Keys that have at least one activated device.
ActivatedMachines.Count() > 0 and ActivatedMachines.Count() < 10- Keys that have at least one and at most 9 activated devices.
Find license keys that have a certain machine code
ActivatedMachines.Count(it.Mid="machine code") > 0- Keys with at least one device that has the machine code “machine code”.
ActivatedMachines.Count(it.Time >= DateTime(2015,01,01)) > 0- Keys that were activated after the 1st of January, 2015.
Sorting based on Data Objects (additional variables)
Every license key can have a set of data objects (aka additional variables) associated with them. They have the following four fields:
- Id - (the unique identifier of the data object, eg. 35.)
- Name - (an optional name of the data object)
- StringValue - (the string value of the data object)
- IntValue - (the int value of the data object)
Find licenses keys that have at least one data object
dataobjects.count() > 0- Keys with at least one data object
Find license keys that have a specific value attached to them
dataobjects.count(it.StringValue="test") > 0- Keys where at least one data object has the string value of “test”.
dataobjects.count(it.name="usagecount") > 0- Keys that have a usage counter (see Set Usage ‘Quota’ for a Feature)
Sorting with Advanced Parameters
Advanced parameters are those that are not displayed directly on the product page, but can be found when selecting individual keys. These are:
- AutomaticActivation - (a Boolean i.e. either true or false, depending on if it should be possible to perform an activation)
- AllowedMachines - (a string, separated by new lines, that contains a white list of devices that can be activated, no matter if the maximum number of machines limit has been achieved)
- TrialActivation - (a Boolean that sets the Trial Activation)
- MaxNoOfMachines - (an integer that specifies the number of devices that can use the same license key simultaneously)
Keys with Trial Activation property
trialactivation = true- Keys with Trial Activation enabled.
Keys with a certain white listed machine code
allowedmachines.contains("machine code")- Keys that have an allowed machine code “machine code”.
- Variable names, eg. AllowedMachines, are case-insensitive, that is, you can express it as "allowedmachines" or "AllowedMachines".