# Referencing canvas variables with outputs of other variables

**URL:** <https://discuss.elastic.co/t/referencing-canvas-variables-with-outputs-of-other-variables/333775>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [May 18, 2023, 1:51pm UTC](https://discuss.elastic.co/t/referencing-canvas-variables-with-outputs-of-other-variables/333775 "2023-05-18T13:51:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dreynolds](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@dreynolds](https://discuss.elastic.co/u/dreynolds)\
**Post date:** [May 18, 2023, 1:51pm UTC](https://discuss.elastic.co/t/referencing-canvas-variables-with-outputs-of-other-variables/333775/1 "2023-05-18T13:51:24Z")

</div>

I have multiple variables defined that have the number of hosts a department should have:  
hr\_hosts: 35, it\_hosts:45, acct\_hosts:5

I'm running a query to pull host scans, which includes the department names as a column "hr", "it", "acct"

I would like to return the value of "hr\_hosts", "it\_hosts", and "acct\_hosts" in a new column.  
I successfully output the variable names, but I'm not sure how to force canvas to actually reference the variables.

mapColumn name='departmentCounts' expression={ getCell department | string "var " { context } "\_hosts"}

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 15, 2023, 1:51pm UTC](https://discuss.elastic.co/t/referencing-canvas-variables-with-outputs-of-other-variables/333775/2 "2023-06-15T13:51:51Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
