cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Matching string to a table of expressions

iabshire
4-Participant

Matching string to a table of expressions

I would like to take an input string and check if it matches any expression in a DataTable of expressions.

 

For example, if the input string is "SomeError1", and the expressions in the DataTable are:

 

"SomeError.*"

"SomeOtherError.*"

".*Error"

 

I want to query if the input string matches any of the expressions in the table. In this case, it would match "SomeError.*".

 

I've tried querying the DataTable entries with LIKE and Matches queries:

 "filters": {
  "type": "Matches",
   "fieldName": "item",
   "expression": "SomeError1"
}

 

"filters": {
    "type": "LIKE",
    "fieldName": "item",
    "value": "SomeError1"
}

 

but it only returns a result if the value/expression field is the expression.

 

Is there any way to accomplish this?

 

Thanks!

3 REPLIES 3
PaiChung
22-Sapphire I
(To:iabshire)

Perhaps you can add a wild card to your search: When using LIKE/NOTLIKE you need to add your own Wild Cards (% or * or ? for a single character wild card). For example to find ThingWorx use LIKE Th%

 

http://support.ptc.com/help/thingworx_hc/thingworx_8_hc/en/#page/ThingWorx%2FHelp%2FComposer%2FThings%2FThingServices%2FQueryParameterforQueryServices.html

iabshire
4-Participant
(To:PaiChung)

Thanks for the reply, but I'm trying to do the opposite. The search string is the full string and I want to check if it matches any expression (with wildcards) in the table.

PaiChung
22-Sapphire I
(To:iabshire)

I don't think there is a set query for that, you probably have to loop through your table and just execute a javascript search

Announcements


Top Tags