# FQL query using a variable does not work

**URL:** <https://community.postman.com/t/fql-query-using-a-variable-does-not-work/46307>\
**Category:** Help Hub\
**Tags:** variables\
**Created:** [April 13, 2023, 12:47pm UTC](https://community.postman.com/t/fql-query-using-a-variable-does-not-work/46307 "2023-04-13T12:47:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![adrian-g](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@adrian-g](https://community.postman.com/u/adrian-g)\
**Post date:** [April 13, 2023, 12:47pm UTC](https://community.postman.com/t/fql-query-using-a-variable-does-not-work/46307/1 "2023-04-13T12:47:34Z")

</div>

Hi

In an Evaluate block with input variables ‘content’ and ‘assetName’ (the latter set to “Core”), why does the first FQL query below work, while the second one using a variable yields null?

```
content[primaryEntity.name="Core"].id

content[primaryEntity.name=assetName].id

```

How can I get this query to work with a variable?

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/0/f/0f78da440facd73a80d20a6345b79a1d4479cd02.png)

Output:  
(2) [“ff32e03ab003”, null]

See also the flow in my public workspace: [New Flow | Help | Postman API Network](https://www.postman.com/adrian-g/workspace/help/flow/6437e202ae331d003130d470)

Many thanks!

---

<div class="post-metadata">

**Author:** ![arlem](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/arlem/32/3078_2.png) [@arlem](https://community.postman.com/u/arlem)\
**Post date:** [April 13, 2023, 4:51pm UTC](https://community.postman.com/t/fql-query-using-a-variable-does-not-work/46307/2 "2023-04-13T16:51:42Z")

</div>

Have you tried using the “string” block to set the variable value instead?

 ![Screenshot 2023-04-14 at 00.50.58](https://us1.discourse-cdn.com/getpostman/original/3X/7/e/7e60ae3b624bc39ecdb01a405fed7922d3cacd57.png)

---

<div class="post-metadata">

**Author:** ![adrian-g](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@adrian-g](https://community.postman.com/u/adrian-g)\
**Post date:** [April 14, 2023, 5:03am UTC](https://community.postman.com/t/fql-query-using-a-variable-does-not-work/46307/3 "2023-04-14T05:03:07Z")

</div>

Hi arlemi

Thanks for your reply. I’ve checked. It’s the same with a string block.

---

<div class="post-metadata">

**Author:** ![arlem](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/arlem/32/3078_2.png) [@arlem](https://community.postman.com/u/arlem)\
**Post date:** [April 14, 2023, 9:30am UTC](https://community.postman.com/t/fql-query-using-a-variable-does-not-work/46307/4 "2023-04-14T09:30:59Z")

</div>

I tried a couple more things and couldn’t get that to work either. [Looking at the docs](https://learning.postman.com/docs/postman-flows/flows-query-language/conditional-data-selection/) I couldn’t find a way to do it either so I’m just assuming this isn’t something you can do in the Evaluate block. Let’s see if someone else has more info!

---

<div class="post-metadata">

**Author:** ![adrian-g](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@adrian-g](https://community.postman.com/u/adrian-g)\
**Post date:** [April 14, 2023, 10:26am UTC](https://community.postman.com/t/fql-query-using-a-variable-does-not-work/46307/5 "2023-04-14T10:26:13Z")

</div>

Thanks, Arlemi. I’ll move this topic to the Help category, as it doesn’t seem to be a beginner’s question anymore.

---

<div class="post-metadata">

**Author:** ![arlem](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/arlem/32/3078_2.png) [@arlem](https://community.postman.com/u/arlem)\
**Post date:** [April 14, 2023, 2:37pm UTC](https://community.postman.com/t/fql-query-using-a-variable-does-not-work/46307/6 "2023-04-14T14:37:26Z")

</div>

Good idea! Someone suggested using:

```auto
(
    $n := assetName;
    content[primaryEntity.name=$n].id;
)

```

which should give you the same result as `content[primaryEntity.name=assetName].id`.

---

<div class="post-metadata">

**Author:** ![adrian-g](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@adrian-g](https://community.postman.com/u/adrian-g)\
**Post date:** [April 14, 2023, 3:14pm UTC](https://community.postman.com/t/fql-query-using-a-variable-does-not-work/46307/7 "2023-04-14T15:14:48Z")

</div>

This works. Many thanks for your help!

---

<div class="post-metadata">

**Author:** ![john.martin](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@john.martin](https://community.postman.com/u/john.martin)\
**Post date:** [October 30, 2023, 6:20pm UTC](https://community.postman.com/t/fql-query-using-a-variable-does-not-work/46307/8 "2023-10-30T18:20:59Z")

</div>

I’m having a similar issue to @adrian-g.

Output to evaluate looks like this:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/7/0/70161c796f0a4aa7a95558d16f8f466c0f3524a8.png)

When I evaluate without grabbing the id, it evaluates boolean for each payroll record.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/1/e/1ec5102d3fb808faabf8846432b6875083c73a50.png)

But when I try to get the id of the record that matches $n, it returns null, and I’m not sure what’s wrong.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/5/e/5e7dd19e486e1e7a462208c7ef8916190d5a6eb8.png)

---

<div class="post-metadata">

**Author:** ![john.martin](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@john.martin](https://community.postman.com/u/john.martin)\
**Post date:** [October 30, 2023, 6:33pm UTC](https://community.postman.com/t/fql-query-using-a-variable-does-not-work/46307/9 "2023-10-30T18:33:17Z")

</div>

I figured it out. I had that extra period between “payrolls” and “[pay\_date=$n].id” and that was throwing it off.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [November 2, 2023, 6:33pm UTC](https://community.postman.com/t/fql-query-using-a-variable-does-not-work/46307/10 "2023-11-02T18:33:36Z")

</div>

Closed on November 2, 2023, 6:33pm UTC

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