Question
· Aug 16, 2023

Message Viewer: Criteria to find value inside first element of a list

Hello,

First of all thanks for reading this question, and thanks for your time, trying to help us.

We would need to find a value inside the first element of a list, which is a property inside a Request Message.

The Message is:

Class Mensajes.Request.Farmacia.Seflogic.InformarSalidasOBMIRequest Extends Ens.Request
{

Parameter RESPONSECLASSNAME = "Mensajes.Response.Farmacia.Seflogic.SincronizacionConsumoResponse";

Property IBLDAT As %String(MAXLEN = "");

Property IBUDAT As %String(MAXLEN = "");

Property IBWART As %String(MAXLEN = "");

Property ILOTEAUTO As %String(MAXLEN = "");

Property IMOVIMIENTOS As list Of EsquemasDatos.Farmacia.Seflogic.p1.MovimientoDT;

Property OMBLNR As %String(MAXLEN = "");

[...]

Being the list we are interested in:

Class EsquemasDatos.Farmacia.Seflogic.p1.MovimientoDT Extends (%SerialObject, %XML.Adaptor)
{

Parameter ELEMENTQUALIFIED = 0;

Parameter NAMESPACE = "http://scs.es/xi/xi_scs/farmacia";

Parameter XMLNAME = "Movimiento_DT";

Parameter XMLSEQUENCE = 1;

Parameter XMLTYPE = "Movimiento_DT";

/// Material
Property MATNR As %String(MAXLEN = 18, XMLNAME = "MATNR");

/// Centro
Property WERKS As %String(MAXLEN = 4, XMLNAME = "WERKS");

/// Almacén
Property LGORT As %String(MAXLEN = 4, XMLNAME = "LGORT");

[...]

How could we add a criteria to find the value "V08984" inside "IMOVIMIENTOS.MATNR"

We have tried the following ways:

Mensajes.Request.Farmacia.Seflogic.InformarSalidasOBMIRequest      
  IMOVIMIENTOS.GetAt(1).MATNR = V08984

Besides, we have also tried the following one:

Mensajes.Request.Farmacia.Seflogic.InformarSalidasOBMIRequest      
  IMOVIMIENTOS.MATNR = V08984

Even more, we have tried the exact same path as it is been displayed as XML inside the Visual Trace:

Mensajes.Request.Farmacia.Seflogic.InformarSalidasOBMIRequest      
  IMOVIMIENTOS.Movimiento_DT.MATNR = V08984

 

📍📌🧷🧮 How would you recommed us to add a criteria to find value inside first element of a list, in this scenario?

 

Thans for your time, help, and again thanks for your help and time.

Product version: IRIS 2020.1
Discussion (3)1
Log in or sign up to continue

Hi Yone,

Message viewer generates SQL queries when you perform a "Search". This means that the GetAt() methods you typically use for Lists won't function properly in the criteria menu.

However, if you simply want to retrieve lists containing "V08984", try using the 'Contains' operator:

 

This way you are treating the List property (IMOVIMIENTOS) as a String, and simply searching for your sub-string within it. If you are interested in learning about how to perform SQL queries against List or Array properties, see this documentation about their SQL projections.

If you are interested in finding the 1st, or 2nd etc element of a List, then you can try using the Match operator, see Matching documentation. There may be better ways of using these operators, but this is the simplest solution I can think of.

It's worth noting that the SQL projected fields of your class will look like this:

 

So pattern matching may be your best option for working with multiple list elements.

Hope that helps!