================================================================================
Object References in Filter Expressions
================================================================================

table 50000 "Test Table"
{
    fields
    {
        field(1; MyField; Integer)
        {
            CalcFormula = count("Job Queue Log Entry" where("Object ID to Run" = filter(Report::"Shpfy Sync Orders from Shopify")));
        }
        field(2; MyField2; Integer)
        {
            CalcFormula = count("Job Queue Log Entry" where("Object ID to Run" = filter(Report::"Report 1" | Report::"Report 2")));
        }
        field(3; MyField3; Integer)
        {
            CalcFormula = count("Job Queue Log Entry" where("Object ID to Run" = filter(Codeunit::"My Codeunit" | Page::"My Page")));
        }
        field(4; MyField4; Integer)
        {
            CalcFormula = count("Job Queue Log Entry" where("Object ID to Run" = filter(XMLPort::MyXMLPort | Query::MyQuery)));
        }
    }
}

--------------------------------------------------------------------------------

(source_file
  (table_declaration
    (table_keyword)
    object_id: (integer)
    object_name: (quoted_identifier)
    (fields_section
      (fields_keyword)
      (field_declaration
        id: (integer)
        name: (identifier)
        type: (type_specification
          (basic_type))
        (property
          name: (property_name)
          value: (aggregate_formula
            function: (aggregate_function)
            target: (calc_field_reference
              (quoted_identifier))
            (where_clause
              (where_conditions
                (where_condition
                  field: (quoted_identifier)
                  (filter_keyword)
                  value: (filter_value
                    (database_reference
                      keyword: (object_type_keyword)
                      table_name: (quoted_identifier)))))))))
      (field_declaration
        id: (integer)
        name: (identifier)
        type: (type_specification
          (basic_type))
        (property
          name: (property_name)
          value: (aggregate_formula
            function: (aggregate_function)
            target: (calc_field_reference
              (quoted_identifier))
            (where_clause
              (where_conditions
                (where_condition
                  field: (quoted_identifier)
                  (filter_keyword)
                  value: (filter_value
                    (database_reference
                      keyword: (object_type_keyword)
                      table_name: (quoted_identifier))
                    (database_reference
                      keyword: (object_type_keyword)
                      table_name: (quoted_identifier)))))))))
      (field_declaration
        id: (integer)
        name: (identifier)
        type: (type_specification
          (basic_type))
        (property
          name: (property_name)
          value: (aggregate_formula
            function: (aggregate_function)
            target: (calc_field_reference
              (quoted_identifier))
            (where_clause
              (where_conditions
                (where_condition
                  field: (quoted_identifier)
                  (filter_keyword)
                  value: (filter_value
                    (database_reference
                      keyword: (object_type_keyword)
                      table_name: (quoted_identifier))
                    (database_reference
                      keyword: (object_type_keyword)
                      table_name: (quoted_identifier)))))))))
      (field_declaration
        id: (integer)
        name: (identifier)
        type: (type_specification
          (basic_type))
        (property
          name: (property_name)
          value: (aggregate_formula
            function: (aggregate_function)
            target: (calc_field_reference
              (quoted_identifier))
            (where_clause
              (where_conditions
                (where_condition
                  field: (quoted_identifier)
                  (filter_keyword)
                  value: (filter_value
                    (database_reference
                      keyword: (object_type_keyword)
                      table_name: (identifier))
                    (database_reference
                      keyword: (object_type_keyword)
                      table_name: (identifier))))))))))))
