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=2 or 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 <= 10 to 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”.

Update: you can search for a specific license without the “key=” prefix. In other words, ITVBC-GXXNU-GSMTK-NIJBT and key="ITVBC-GXXNU-GSMTK-NIJBT” are equivalent.

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.

Variables

In addition, you can use variables such as tomorrow, monthbackmonthforward>.

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.
  • EnableCustomerAssociation - Whether it should be possible to customers to sign up for an account (a boolean).
  • IsPublic - Whether resellers should be able to see this customer. Note, if a reseller is registered with this customer, they will still be able to see it even if this is set to false (a boolean).
  • ResellerId - The UserId of the account that acts as a reseller (an integer).
  • MaxNoOfDevices - The maximum number of devices that the customer can log in on if user account authentication is used (an integer).
  • Owner - the user id of the owner of this object. This will be your user id (an integer).

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 Reseller (only in dashboard)

You can use the reseller id of a reseller to find licenses that they have issued. For example:

  • resellerid=1234 - show only licenses created by reseller with id 1234.
  • resellerid=-1 - show licenses that were not created by any reseller.

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

Keys with a certain white listed machine code

  • allowedmachines.contains("machine code") - Keys that have an allowed machine code “machine code”.

Notes

  • Variable names, eg. AllowedMachines, are case-insensitive, that is, you can express it as "allowedmachines" or "AllowedMachines".