As of 2014 we suggest the use of EZ-MES Validator.  This page will be left as reference to users still using it.

MES has its own query language. The general syntax for an MES query consist of 4 main attributes with several sub attributes. The 4 main attributes are separate input fields in the EZ_SoapReader application.

If we take a closer look at the saved sample query, we can see the main 4 attributes:

{

"arJSColm":"[{{\"sTyp\":\"jobname\",\"sNm\":\"sJob\",\"sFilterValue\":\"\",\"sTitle\":\"No\"}}]",

"o":"{\"sFlowName\":\"FR_Flow\"}",

"arCheckVals":"null",

"oSort":"null"

}

The query representation is using JSON.

The arguments of an object have the name of the argument between quotes (shown in red), and the value of the argument between quotes (shown in blue) separated by a colon.

<arJSColm (S_arJSColm in SOAP)

arJSColm is an JSON array that describes all the output columns you would like to display for the MES object you are querying.

Each JSON column object in the array can have the following arguments:

  1. sTyp = Is the Data Type for the returned data, and can have the following values:
    1. string
    2. number
    3. date
    4. datetime
    5. jobname
      This is a string representations for the MES object and can be different for each MES Object. E.g. for a Flow Definition it would be the Flow Number + Flow Name + Flow Rev
      1. i.      For Part Records the jobname is the UID of the part
  2. sNm = is the Data Base Name, basically the name of the MES Object attribute you would like to display you would like to display in the column. See one of the following Chapters for the different possible attributes
  3. sTitle = Is the title for the output column. In case of an Excel export this title will show up in the header column of the Excel spreadsheet
  4. oHash = Is a HashTable used to perform a Key to Val search.
  5. arJbConv = Is a array of Attributes to get to another MES Object type
    For Example, sFRFD links from the FR MES Object to the FD MES Object so if you pass in "arJbConv:['sFRFD']" then the Name will be "sNm" will be addressing FD attributes and not FR attributes
  6. sFilterValue = Used to filter for values within this column

Filter empty values

Empty values can be filtered to apply a filter to the column for which you only want to show data entries:

"sFilterValue":"& != []"

Notes

The first set of characters for example "sFRFD" the "sFR" means it is on the FR Object or Table, if you look at the data diagrams almost all attributes will start with sFR on the FR Object, the exceptions are the following attributes that are available on each MES Object:

  • CurrentStatus
  • Initiator
  • DateTimeCreated

o (S_o in SOAP presentation)

The o argument is the main part of the MES query, it defines which MES objects (table) needs to be queried.

  1. sFlowName: what Object to query
  2. sJobFirst and sValNext: Are used for link list queries in case the object is a linked list E.g. Blog Items.

The different names for the different MES Objects are a combination of the Object Code + ‘_Flow’. Most MES object codes consist of 2 or 3 characters and are given in the following chapter.

A couple of examples for sFlowName values:

  1. FR_Flow
    FR is the MES Code for the Traveler Object (Flow Record)
    In EZ_SoapReader, using {“sFlowName”:”FR_Flow”} as the second argument (labeled with S_o) will query all the Travelers. (this happens in the Pre configured Sample)
  2. PR_Flow: Part Records
  3. NVR_Flow: Recorded Data for parts (Name-Value Records)

arCheckVals (S_arCheckVals in SOAP)

The arCheckVals argument defines the Filters or Where Clauses. The argument is an JSON array containing JSON objects.

 

The syntax for each object in the arCheckVals is very similar to the syntax for the objects for the arJSColm (described above). The arCheckVals has the following arguments:

  1. _EZQueryItem:true
    Should always be true if using this syntax
  2. [sNm] is the DataBase Name
  3. [sTyp] is the Data Type
  4. [sVal] is what the actual filter data value
  5. [sOperation] is the Operation to Perform
  6. [bAnd] = is a Boolean stating if it is a AND operation (Cannot be true if bOr is true)
  7. [bOr] = is a Boolean stating if it si a OR operation (Cannot be true if bAnd is true)
  8. [arJbConv] is the same as the column defined above it converts the object so you can access attributes of linked objects See Above
  9. [bCase] sets if it is Case Sensitive False is default
  10. Supported Operations Include:
    • [==] Equals
    • [!=] Not Equal
    • [>] Greater Than
    • [>=] Greater than or Equal
    • [<] Less Than
    • [<=] Less Than or Equal
    • [contains] if the string contains any part of the string
    • [!contains] is the string dose not contain part of the string
    • [regex] Equal To regular expression

Example

[{"_EZQueryItem":true,"sNm":"sPRPartType","sTyp":"string","sOperation":"!=","sVal":"Consumed","bAnd":true,"bOr":false,"bCase":false,"arJbConv":[]},{"_EZQueryItem":true,"sNm":"sPRFRProcessState","sTyp":"string","sOperation":"contains","sVal":"DONE","bAnd":true,"bOr":false,"bCase":false,"arJbConv":[]}]

 

This example array for the arCheckVals contains 2 Objects (one in blue and one in green)

  1. The first object checks the Parts sPRPartType does not equal "Consumed"
  2. The second object checks that the sPRFRProcessState Contains "DONE"

oSort (S_oSort in SOAP)

The oSort argument defines an JSON object for the sort operation. This sort operation is performed after the data has been filtered.

Syntax:

  1. [sSort] can have the following values:
    • [SortA] Sort Ascending
    • [SortD] Sort Descending
  2. [sTyp] = Same as Above String, Number .......
  3. [sNm] = Name of Attribute Same as Above
  4. [arJbConv] =Same as Above

Writing your own MES Queries

A couple of tips:

  1. All arguments come with default values, so it is not required to pass in all the argument values each time.
  2. Passing in ‘null’ for the checkvals is a simple way to get all the MES object instances.
  3. The arCheckVals are performed in Order so the order of these can affect the speed.
  4. Date Attributes will support Partial Date Strings for example > "Mar 2009" would work

 

We recommend to use the EZ_SoapReader to write your own MES Queries, after you tested them, you can save them by pressing the SAVE button. Using the EZ_SoapReader you will be able to Load any saved MES Query and execute the query.

 

Useful Links