PQL abbreviate() function
abbreviate() — Limits the length of a string.
Syntax
The abbreviate() function returns a string and
takes 3 parameters:
| return value | function(parameters) | |
| string | abbreviate(tree, string, string) |
Return value
The abbreviate() function returns a string.
Description
The abbreviate() function limits
the length of a string, and adds elipses to represent the missing content. You
can use a third argument such as 'start', 'middle', or
'end'' to indicate which part of the string to remove.
Examples
You can run these examples against your own data in your GoToManage search field, or against fictitious data in the Query Sandbox:
- Example 1: Abbreviate from the middle
- Example 2: Abbreviate from the end
- Example 3: Abbreviate mailbox names
Example 1: Abbreviate from the middle
Query: Find and display names abbreviated from the middle.
SELECT abbreviate(name, 20, 'middle') FROM /network/device/wmi/win32_product
This query abbreviates names that are greater than 20 characters long and adds an elipses to represent the missing characters.
Results: Depending on the database, this query returns results similar to this:
row abbreviate(name, 20, middle) Microsoft. . .90.2075) row abbreviate(name, 20, middle) Advanced . . .ller 6.2 row abbreviate(name, 20, middle) Microsoft. . .lish) 12 row abbreviate(name, 20, middle) Microsoft. . .sh) 2007 . . .
Example 2: Abbreviate from the end
Query: Find and display names abbreviated from the middle.
SELECT abbreviate(name, 20, 'end') FROM /network/device/wmi/win32_product
This query abbreviates names from the end that are greater than 20 characters long, and adds elipses to represent the missing characters.
Results: Depending on the database, this query returns results similar to this:
row abbreviate(name, 20, end) Microsoft Platfor. . . row abbreviate(name, 20, end) Advanced Installe. . . row abbreviate(name, 20, end) Microsoft Softwar. . . row abbreviate(name, 20, end) Microsoft Office. . . . . .
Example 3: Abbreviate mailbox names
Query: Find and list the top mailboxes and abbreviate names longer than 30 characters.
SELECT abbreviate(mailboxdisplayname, 30) as "Name",
totalitems as "# Items", format(size * 1024,
'human_bytes') as Size
FROM /network/device/wmi/exchange_mailbox
order trees by size desc
This query abbreviates names from the end that are greater than 30 characters long, and adds elipses to represent the missing characters.
Results: Depending on the database, this query returns results similar to this:
row
Name: Francisco GoToManage
# Items: 362
Size: 7.83 MB
row
Name: SystemMailbox{342BAD07-A159. . .
# Items: 265
Size: 6.92 MB
row
Name: SMTP (EXCHANGE-{342BAD07-A2. . .
# Items: 401
Size: 361.00 KB
. . .
To see other PQL functions, see Functions.