===================
Basic Query Test
===================

query 50102 "Top Customer Overview"
{
    QueryType = Normal;
    Caption = 'Top Customer Overview';

    // Teaching tip title and text. Available from version 23
    AboutTitle = 'Analyze your customers (slice and dice your data)';
    AboutText = 'Use this data cube to analyze your customers. You can group and/or the data on any dimension you like.';

    // Controls the help link for this query. Available from version 23
    ContextSensitiveHelpPage = 'customer_query_help.html';

    // Category to show the query under in Tell Me (search) and in role explorer under Report and Analysis. Available from version 23
    UsageCategory = ReportsAndAnalysis;


    DataAccessIntent = ReadOnly; // use this to read data from the secondary database replica to speed up performance

    elements
    {
        dataitem(Customer; Customer)
        {
            column(Name; Name)
            {
            }
            column(No; "No.")
            {
            }
            column(Sales_LCY; "Sales (LCY)")
            {
            }
            column(Profit_LCY; "Profit (LCY)")
            {
            }
            column(Country_Region_Code; "Country/Region Code")
            {
            }
            column(City; City)
            {
            }
            column(Global_Dimension_1_Code; "Global Dimension 1 Code")
            {
            }
            column(Global_Dimension_2_Code; "Global Dimension 2 Code")
            {
            }
            column(Salesperson_Code; "Salesperson Code")
            {
            }
            dataitem(Salesperson_Purchaser; "Salesperson/Purchaser")
            {
                DataItemLink = Code = Customer."Salesperson Code";
                column(SalesPersonName; Name)
                {
                }
                dataitem(Country_Region; "Country/Region")
                {
                    DataItemLink = Code = Customer."Country/Region Code";
                    column(CountryRegionName; Name)
                    {
                    }
                }
            }
        }
    }
}

---

(source_file
  (query_declaration
    (query_keyword)
    object_id: (integer)
    object_name: (quoted_identifier)
    (property
      name: (property_name)
      value: (identifier))
    (property
      name: (property_name)
      value: (string_literal))
    (comment)
    (property
      name: (property_name)
      value: (string_literal))
    (property
      name: (property_name)
      value: (string_literal))
    (comment)
    (property
      name: (property_name)
      value: (string_literal))
    (comment)
    (property
      name: (property_name)
      value: (identifier))
    (property
      name: (property_name)
      value: (identifier))
    (comment)
    (elements_section
      (elements_keyword)
      (query_dataitem
        (dataitem_keyword)
        name: (identifier)
        table_name: (identifier)
        (query_column
          (column_keyword)
          name: (identifier)
          field_name: (identifier))
        (query_column
          (column_keyword)
          name: (identifier)
          field_name: (quoted_identifier))
        (query_column
          (column_keyword)
          name: (identifier)
          field_name: (quoted_identifier))
        (query_column
          (column_keyword)
          name: (identifier)
          field_name: (quoted_identifier))
        (query_column
          (column_keyword)
          name: (identifier)
          field_name: (quoted_identifier))
        (query_column
          (column_keyword)
          name: (identifier)
          field_name: (identifier))
        (query_column
          (column_keyword)
          name: (identifier)
          field_name: (quoted_identifier))
        (query_column
          (column_keyword)
          name: (identifier)
          field_name: (quoted_identifier))
        (query_column
          (column_keyword)
          name: (identifier)
          field_name: (quoted_identifier))
        (query_dataitem
          (dataitem_keyword)
          name: (identifier)
          table_name: (quoted_identifier)
          (property
            name: (property_name)
            value: (property_expression
              (comparison_expression
                left: (identifier)
                operator: (comparison_operator)
                right: (member_expression
                  object: (identifier)
                  member: (quoted_identifier)))))
          (query_column
            (column_keyword)
            name: (identifier)
            field_name: (identifier))
          (query_dataitem
            (dataitem_keyword)
            name: (identifier)
            table_name: (quoted_identifier)
            (property
              name: (property_name)
              value: (property_expression
                (comparison_expression
                  left: (identifier)
                  operator: (comparison_operator)
                  right: (member_expression
                    object: (identifier)
                    member: (quoted_identifier)))))
            (query_column
              (column_keyword)
              name: (identifier)
              field_name: (identifier))))))))
