---
schema_version: "1"
id: 7dd2433058171b8a44ad0f592f2fdbebfff7c5f5b1c5c81d957385e4be401320
title: Query Data
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi-dev-guide-lwc-in-db/guides/concept/bi-lwc-in-db-hw-example-query-data.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-lwc-in-db/guide/bi-lwc-in-db-hw-example-query-data.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 3b8835a8b5738e5cd89888b1d5f8912d6d893f31239bc7ba6e1c937af148ef30
products:
  - Lightning Web Components in CRM Analytics Dashboards
  - analytics
---

# Query Data

Let’s learn how to inject query results into your running Lightning Web Component code.

**note:** This doesn't apply to custom Lightning web components in Lightning dashboards as they don't query data.

To start, modify your Hello World component to use a step by setting `hasStep` to `true` in the `js-meta.xml`.

```xml
<hasStep>true</hasStep>
```

Add the results wiring into your `.js` file.

```javascript
import { LightningElement, api } from "lwc";

export default class HelloWorld extends LightningElement {
  @api title;

  @api results;

  get stringResults() {
    return JSON.stringify(this.results);
  }
}
```

To view the query results as text, update your `.html` file.

```html
<template>
  Hello World: {title} Results: {stringResults}
</template>
```

Deploy the changes to your component to your org. Refresh your dashboard to pick up any updates to the component code. After refreshing the dashboard, edit the dashboard and click your component. You’re now prompted to select a data source. You can select a dataset to create a query or select an existing query. Make your selection and watch the query results appear in your dashboard.

**See Also**

- [Component Attributes](https://developer.salesforce.com/docs/analytics/bi-dev-guide-lwc-in-db/guide/bi-lwc-in-db-hw-example-attributes.md)
- [CRM Analytics Configuration](https://developer.salesforce.com/docs/analytics/bi-dev-guide-lwc-in-db/guide/bi-lwc-in-db-hw-example-config.md)
- [Lightning Dashboards Configuration](https://developer.salesforce.com/docs/analytics/bi-dev-guide-lwc-in-db/guide/bi-lwc-in-db-hw-example-lightning-dashboard-config.md)
- [Other Widgets](https://developer.salesforce.com/docs/analytics/bi-dev-guide-lwc-in-db/guide/bi-lwc-in-db-hw-example-other.md)
