Problem with a!queryFilter

Hi! I´m trying to make a list of elements (local!ListadoMateriales) to use in a dropdown. To make this list, I´m querying a database (CPF_LineasPedidos) and applying a filter (only materials where the idPedido is equal to the selected in a previous interface)

The fact here is that my filter is failing (the value must not be null or empty), I think that the "idPedido" value is not flowing from the process model into my new interface

1. Capture of the code. The ri!recordFact refers to the database in which I have the idPedido

This is what I want to do:

First interface (idPedido selected):

Second Interface (the one I´m editing, referred with the code in the end of the post). I want the list to make a dropdown in the "Material" column values. I add that the values Factura, Pedido and Proveedor are SAVED from the last interface referring them inside the function append (line 206)

Thanks a lot!

This is my code:

a!localVariables(
  local!LineasFactura:{},
  local!ListadoMateriales: index(
    a!queryRecordType(
      recordType: 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido',
      fields: {
        'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{69e9a834-b2fb-4f35-a36d-3c526c97f4ac}Material'
      },
      filters: {
        a!queryFilter(
          field: 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{71427dbb-12db-4f83-bd99-f625bf9af271}idPedido',
          operator: "=",
          value: ri!recordFact['recordType!{51d44df6-c727-4443-8114-aef8a7509b41}CPF Maestro Facturas.fields.{e8009662-ca1c-43da-9c72-2840463214be}id_pedido']
        )},

        pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 100)
    ).data,
    'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{69e9a834-b2fb-4f35-a36d-3c526c97f4ac}Material',
    {}
  ),
  {
    a!sectionLayout(
      label: "Líneas Factura",
      labelIcon: "list-alt-solid",
      contents: {
        a!gridLayout(
          label: "A continuación, incorpore las líneas de factura correspondientes y pulse el botón de creación",
          headerCells: {
            a!gridLayoutHeaderCell(label: "Linea Factura"),
            a!gridLayoutHeaderCell(label: "Factura"),
            a!gridLayoutHeaderCell(label: "Pedido"),
            a!gridLayoutHeaderCell(label: "Proveedor"),
            a!gridLayoutHeaderCell(label: "Material"),
            a!gridLayoutHeaderCell(label: "Precio Unitario"),
            a!gridLayoutHeaderCell(label: "Cantidad"),
            a!gridLayoutHeaderCell(label: "Importe Total"),
            a!gridLayoutHeaderCell()
          },
          columnConfigs: {
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "ICON")
          },
          rows: a!forEach(
            items: local!LineasFactura,
            expression: a!gridRowLayout(
              contents: {
                a!textField(
                  value: fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{181742a7-4305-4134-b05e-4eebc9c56292}idLineaFactura'],
                  saveInto: {
                    fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{181742a7-4305-4134-b05e-4eebc9c56292}idLineaFactura']
                  }
                ),
                a!textField(
                  value: fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{9c440183-9c71-423b-a300-eb4c3ea747fb}idFactura'],
                  saveInto: {
                    fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{9c440183-9c71-423b-a300-eb4c3ea747fb}idFactura']
                  }
                ),
                a!textField(
                  value: fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{60774c8e-9b47-486f-9fea-b32c525c05fd}idPedido'],
                  saveInto: {
                    fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{60774c8e-9b47-486f-9fea-b32c525c05fd}idPedido']
                  }
                ),
                a!textField(
                  value: fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{844be35b-6de5-434e-9c69-e7c7b8a148dd}proveedor'],
                  saveInto: {
                    fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{844be35b-6de5-434e-9c69-e7c7b8a148dd}proveedor']
                  }
                ),
                a!textField(
                  value: fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{019eb28b-727b-4e2c-8160-1bcf8a747ef1}material'],
                  saveInto: {
                    fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{019eb28b-727b-4e2c-8160-1bcf8a747ef1}material']
                  }
                ),
                a!floatingPointField(
                  value: fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{eda9bda7-ae57-44e7-a651-d097c8581021}precioUnit'],
                  saveInto: {
                    fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{eda9bda7-ae57-44e7-a651-d097c8581021}precioUnit'],
                    a!save(
                      fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{53f231a2-9bf7-40a1-af07-74373fa7bd9f}importe'],
                      if(
                        or(
                          isnull(
                            fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{b1b5fc0b-5be4-45be-8342-381cdc56017d}cantidad']
                          ),
                          isnull(
                            fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{eda9bda7-ae57-44e7-a651-d097c8581021}precioUnit']
                          )
                        ),
                        0,
                        fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{b1b5fc0b-5be4-45be-8342-381cdc56017d}cantidad'] * fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{eda9bda7-ae57-44e7-a651-d097c8581021}precioUnit']
                      )
                    )
                  },
                  required: true,
                  validations: {
                    if(
                      a!isNotNullOrEmpty(
                        fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{eda9bda7-ae57-44e7-a651-d097c8581021}precioUnit']
                      ) = false,
                      "",
                      if(
                        fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{eda9bda7-ae57-44e7-a651-d097c8581021}precioUnit'] < 0,
                        "El precio unitario debe ser superior a cero",
                        ""
                      )
                    )
                  }
                ),
                a!integerField(
                  value: fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{b1b5fc0b-5be4-45be-8342-381cdc56017d}cantidad'],
                  saveInto: {
                    fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{b1b5fc0b-5be4-45be-8342-381cdc56017d}cantidad'],
                    a!save(
                      fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{53f231a2-9bf7-40a1-af07-74373fa7bd9f}importe'],
                      if(
                        or(
                          isnull(
                            fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{b1b5fc0b-5be4-45be-8342-381cdc56017d}cantidad']
                          ),
                          isnull(
                            fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{eda9bda7-ae57-44e7-a651-d097c8581021}precioUnit']
                          )
                        ),
                        0,
                        fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{b1b5fc0b-5be4-45be-8342-381cdc56017d}cantidad'] * fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{eda9bda7-ae57-44e7-a651-d097c8581021}precioUnit']
                      )
                    )
                  },
                  required: true,
                  validations: {
                    if(
                      a!isNotNullOrEmpty(
                        fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{b1b5fc0b-5be4-45be-8342-381cdc56017d}cantidad']
                      ) = false,
                      "",
                      if(
                        fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{b1b5fc0b-5be4-45be-8342-381cdc56017d}cantidad'] < 1,
                        "La cantidad debe ser superior a cero",
                        ""
                      )
                    )
                  }
                ),
                a!floatingPointField(
                  value: if(
                    or(
                      isnull(
                        fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{b1b5fc0b-5be4-45be-8342-381cdc56017d}cantidad']
                      ),
                      isnull(
                        fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{eda9bda7-ae57-44e7-a651-d097c8581021}precioUnit']
                      )
                    ),
                    0,
                    fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{b1b5fc0b-5be4-45be-8342-381cdc56017d}cantidad'] * fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{eda9bda7-ae57-44e7-a651-d097c8581021}precioUnit']
                  ),
                  saveInto: {
                    fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{53f231a2-9bf7-40a1-af07-74373fa7bd9f}importe']
                  },
                  required: true,
                  validations: {
                    if(
                      a!isNotNullOrEmpty(
                        fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{53f231a2-9bf7-40a1-af07-74373fa7bd9f}importe']
                      ) = false,
                      "",
                      if(
                        fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{53f231a2-9bf7-40a1-af07-74373fa7bd9f}importe'] < 0,
                        "El importe debe ser superior a cero",
                        ""
                      )
                    )
                  },
                  align: "RIGHT"
                ),
                a!richTextDisplayField(
                  value: {
                    a!richTextIcon(
                      icon: "times-circle",
                      link: a!dynamicLink(
                        value: remove(local!LineasFactura, fv!index),
                        saveInto: local!LineasFactura
                      ),
                      linkstyle: "STANDALONE",
                      color: "NEGATIVE"
                    )
                  }
                )
              }
            )
          ),
          addrowlink: a!dynamicLink(
            label: "Añadir nueva Línea de Factura",
            saveInto: a!save(
              target: local!LineasFactura,
              value: append(
                local!LineasFactura,
                'recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura'(
                  'recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{9c440183-9c71-423b-a300-eb4c3ea747fb}idFactura': ri!recordFact['recordType!{51d44df6-c727-4443-8114-aef8a7509b41}CPF Maestro Facturas.fields.{6f993c32-7f64-424a-859f-d779194c4a18}id_factura'],
                  'recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{60774c8e-9b47-486f-9fea-b32c525c05fd}idPedido': ri!recordFact['recordType!{51d44df6-c727-4443-8114-aef8a7509b41}CPF Maestro Facturas.fields.{e8009662-ca1c-43da-9c72-2840463214be}id_pedido'],
                  'recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{844be35b-6de5-434e-9c69-e7c7b8a148dd}proveedor': ri!recordFact['recordType!{51d44df6-c727-4443-8114-aef8a7509b41}CPF Maestro Facturas.fields.{c2a60669-567e-41b8-acdd-29729912b3e5}nomProveedor']
                )
              )
            )
          )
        )
      }
    ),
    a!buttonLayout(
      primaryButtons: {
        a!buttonWidget(
          label: "Completar Creación Factura",
          saveInto: a!save(ri!recordLineasFact, local!LineasFactura
          ),
          submit: true,
          style: "PRIMARY",
          validate: true
        )
      },
      secondaryButtons: {
        a!buttonWidget(
          label: "Cancelar",
          value: true,
          saveInto: ri!cancel2,
          submit: true,
          style: "NORMAL",
          validate: false
        )
      }
    )
  }
)

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    The error message says the value you're attempting to filter on based on ri!recordFact needs to be not null... while at the same time you've left ri!recordFact null (at least in your interface editor).  For the purposes of creating / editing / testing it at least, you'd need to set a test value for this rule input if your assumption is that one will be passed-in from the process.

    As far as whether you're actually passing in a value from the process - we'd need to see your process instance data and the task setup to see how you're attempting to pass the data into the task form, which you didn't include here.

Reply
  • 0
    Certified Lead Developer

    The error message says the value you're attempting to filter on based on ri!recordFact needs to be not null... while at the same time you've left ri!recordFact null (at least in your interface editor).  For the purposes of creating / editing / testing it at least, you'd need to set a test value for this rule input if your assumption is that one will be passed-in from the process.

    As far as whether you're actually passing in a value from the process - we'd need to see your process instance data and the task setup to see how you're attempting to pass the data into the task form, which you didn't include here.

Children