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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

JavaScript Queries

i_abidi
10-Marble

JavaScript Queries

 Hello, i'm trying to query an InfoTable column using multi-input, to illustrate: 

My InfoTable data shape is like this : Code(number) , Product(string) & Line (string), the line field contains a lot of numbers seperated by - 

I want my JS query to return ligns ending with 922 or 921. the query i wrote is this : 

var query = {
"filters": {
"fieldName": "Line",
"type": "LIKE",
"value": criteria
}
};

var params = {
t: me.myProdInfoTable /* INFOTABLE */,
query: query /* QUERY */
};

// result: INFOTABLE
var result = Resources["InfoTableFunctions"].Query(params);

With criteria as my string input. the query works when i put %22 but does not work when i put "%22", "%21". Can anyone help me, thank you

ACCEPTED SOLUTION

Accepted Solutions

You need and OR condition, or if the infotable it's not big, just iterate on a for loop and check for the desired lines.

 

To do the or condition it will be something like:

 

var query = {
  "filters": {
    "type": "OR",
    "filters": [
      {
        "fieldName": "Line",
        "type": "LIKE",
        "value": : criteria1
      },
       {
        "fieldName": "Line",
        "type": "LIKE",
        "value": : criteria2
      }
    ]
  }
};

View solution in original post

4 REPLIES 4
Velkumar
19-Tanzanite
(To:i_abidi)

Hello @i_abidi

 

Try this query,

 

var criteria = "*" + YOURINPUT
var query = {
  "filters": {
    "fieldName": "Line",
    "type": "LIKE",
    "value": criteria 
  }
};

Thanks,

VR

 

 

 

 

 

Still not working, it returns an empty table when it's suppose to return a couple of rows

You need and OR condition, or if the infotable it's not big, just iterate on a for loop and check for the desired lines.

 

To do the or condition it will be something like:

 

var query = {
  "filters": {
    "type": "OR",
    "filters": [
      {
        "fieldName": "Line",
        "type": "LIKE",
        "value": : criteria1
      },
       {
        "fieldName": "Line",
        "type": "LIKE",
        "value": : criteria2
      }
    ]
  }
};
slangley
23-Emerald II
(To:CarlesColl)

Hi @i_abidi.

 

If one of the previous responses provided an answer to your question, please mark it as the Accepted Solution for the benefit of others who may have the same question.

 

Regards.

 

--Sharon

Announcements


Top Tags