Skip to content

index option does not work correctly #145

@akalitenya

Description

@akalitenya

What happens?

if ".malloy" file has 2 "run" statements, then only "index 1" works.

"index 0" - "Error: Statement indexes are 1-based - did you mean to use 1 instead of 0?" - this should not work - ok

"index 2" does not work - "Error: Query index 2 is out of bounds"

##! experimental{sql_functions}

import './tables/c1_order_items_tx.malloy';
import './tables/c1_orders_tx.malloy';
import './tables/c1_users_tx.malloy';
import './tables/c1_user_order_facts_tx.malloy';
import './tables/c1_inventory_items_tx.malloy';
import './tables/c1_products_tx.malloy';
import './tables/c1_distribution_centers_tx.malloy';

#(mprove) model
#(mprove) label="Order Items"
#(mprove) top_label="Order Items"
source: c1_order_items is c1_order_items_tx extend {
  join_one: orders is c1_orders_tx on order_id = orders.order_id
  join_one: users is c1_users_tx on orders.user_id = users.user_id
  join_one: user_order_facts is c1_user_order_facts_tx on users.user_id = user_order_facts.user_id
  join_one: inventory_items is c1_inventory_items_tx on inventory_item_id = inventory_items.inventory_item_id
  join_one: products is c1_products_tx on inventory_items.product_id = products.product_id
  join_one: distribution_centers is c1_distribution_centers_tx on inventory_items.distribution_center_id = distribution_centers.distribution_center_id

  measure: 
    #(mprove) format_number='$,.0f'
    total_profit is total_sale_price - inventory_items.total_actual_cost
    #(mprove) format_number='.2%'
    # percent
    profit_margin is total_profit / total_sale_price
}

query: q1 is c1_order_items -> {
  aggregate: users.users_count
}

query: q2 is c1_order_items -> {
  aggregate: orders.orders_count
}

run: c1_order_items -> {
  aggregate: order_items_count
}

run: c1_order_items -> {
  aggregate: total_sale_price
}

To Reproduce

OS:

macOS devcontainer

Malloy Client:

cli

Malloy Client Version:

0.0.52

Database Connection:

postgres

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions