Find an Answer
abbreviate() — Limits the length of a string.
The abbreviate() function returns a string and takes 3 parameters:
| return value | function(parameters) |
| string | abbreviate(tree, string, string) |
The abbreviate() function returns a string.
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.
You can run these examples against your own data in your GoToAssist search field, or against fictitious data in the Query Sandbox:
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 . . .
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. . . . . .
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 GoToAssist
# 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.
Related topics