Project

General

Profile

Actions

Feature #4305

closed

Filtering language possibility to test for string length

Added by Pavel Kácha over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Development - Core
Target version:
Start date:
09/14/2018
Due date:
% Done:

100%

Estimated time:
To be discussed:

Description

size(ID) does not return correct values for scalars, which may be by design (array lengths).

"rule": "size(ID) < 8" in Inspector matches even for "ID": "f6b06cc8-15ee-4232-be6b-ac8857f23b26".

Suspect is the usage of method pynspect.jpath.jpath_values(), which always returns array, so size may work on array, not string.

One possibility is to make size work on strings, which however may be incompatible or special cased in jpath_values usage.

Another possibility is specific function for strings (like strlen or so).

Actions #1

Updated by Jan Mach over 6 years ago

  • Status changed from New to Feedback
  • Assignee changed from Jan Mach to Pavel Kácha
  • % Done changed from 0 to 100

I have updated the Pynspect library to support the strlen function, which implements the feature related to this ticket. It is available in Pynspect version 0.16 and all unit tests are working ok. Please see the unit test method pynspect.tests.test_filters.test_08_functions() for example usage. For quick intro following expressions work:

strlen(ID) > 8
strlen(Node.Name) > 20

When multiple values are returned for given JPath, comparison operation is ORED (evaluates as true in case at least one value matches the expression).

I have installed the aforementioned library to our production server for testing in production environment and restarted the Mentat system. Everything is working fine and in order.

Actions #2

Updated by Pavel Kácha over 6 years ago

  • Status changed from Feedback to Closed

Checks for ID and Description added to Inspector B. Thx.

Actions

Also available in: Atom PDF