Filter and organise data from database

Hi!

I have a cdt that contains a list of cdts. My question is, is it possible to filter the data so that in a list it shows me only those that contain a special element in that list of cdt ?.

For example, I try to find the cdt that contains element 1 in your list. But my problem is that I don't know how to filter based on an if, that is, based on true or false.
Can anyone help me here?

Thanks in advance!

 

  Discussion posts and replies are publicly visible

  • I recommend viewing our query recipes https://docs.appian.com/suite/help/20.1/Query_Recipes.html#overview

    You can query and filter data from a list of CDTs, using the visual query editor will help with that https://docs.appian.com/suite/help/20.1/using-the-query-editor.html

  • Hello, thank you very much for the advice. I have already read all the documentation on the subject.

    However, I was unable to fix the problem. When I create the filter I get this error: Cannot filter by field [turn] because it is a complex, multiple, or child of a multiple data type. (APNX-1-4203-020).

    This is my filter:



     

    a!recordFilterList(
      name: "Status",
      options: {
        a!recordFilterListOption(
          id: 1,
          name: "Active",
          filter: a!queryFilter(
            field: "turno",
            operator: "includes",
            value: 'type!{urn:com:lv:mr}LV_MR_SHIFTS'(numero:1)
          )
        )
      },
      defaultOption: "Active",
      isVisible: true,
      allowMultipleSelections: true
    )

    . And here is the structure of my cdt:

    School CDT -> other fields, shift (which is a list of shifts with the structure (number: 1, value: 3))

    So what I am trying is to filter the list of cdt schools from my database, so that it only shows me the cdt schools, which have a  shift with number: 1 ,within their list of shifts. I hope I have explained myself well and appreciate any help. Thank you very much in advance.

    Luis.

  • Hello, thank you very much for the advice. I have already read all the documentation on the subject.

    However, I was unable to fix the problem. When I create the filter I get this error: Cannot filter by field [turn] because it is a complex, multiple, or child of a multiple data type. (APNX-1-4203-020).

    This is my filter:



     

    a!recordFilterList(
      name: "Status",
      options: {
        a!recordFilterListOption(
          id: 1,
          name: "Active",
          filter: a!queryFilter(
            field: "turno",
            operator: "includes",
            value: 'type!{urn:com:lv:mr}LV_MR_SHIFTS'(numero:1)
          )
        )
      },
      defaultOption: "Active",
      isVisible: true,
      allowMultipleSelections: true
    )

    . And here is the structure of my cdt:

    School CDT -> other fields, shift (which is a list of shifts with the structure (number: 1, value: 3))

    So what I am trying is to filter the list of cdt schools from my database, so that it only shows me the cdt schools, which have a  shift with number: 1 ,within their list of shifts. I hope I have explained myself well and appreciate any help. Thank you very much in advance.

    Luis.

  • 0
    Appian Employee
    in reply to luisv

    When using a!queryFilter() the 'value' must be of the same type as the 'field'. In your CDT if the field 'turno' is a number, then the value must also be a number. 'type!{urn:com:lv:mr}LV_MR_SHIFTS'(numero:1) is a CDT and not a valid value. As the error message says, value on queryFilter() cannot be "complex, multiple, or child of a multiple data type." when using aqueryFilter within a record filter list

  • Hi!

    But 'turno' is also of  the same type, I mean, i a list of CDTs 'type!{urn:com:lv:mr}LV_MR_SHIFTS'(numero: any number).

    So it is impossible to filter data depending on whether an element is not inside a cdt list nested to a cdt? Thanks!