# Leveraging a query for a conditional value

**URL:** <https://community.glideapps.com/t/leveraging-a-query-for-a-conditional-value/61966>\
**Category:** Ask for Help\
**Created:** [May 20, 2023, 7:22pm UTC](https://community.glideapps.com/t/leveraging-a-query-for-a-conditional-value/61966 "2023-05-20T19:22:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [May 20, 2023, 7:22pm UTC](https://community.glideapps.com/t/leveraging-a-query-for-a-conditional-value/61966/1 "2023-05-20T19:22:26Z")

</div>

I’ve created a query that looks for every item in which Column1 contains Value1 AND Column2 contains Value2. Now I want to leverage that in an ITE column to say “If this row is within the results of the query, return ValueA, otherwise return Column1.” I have tried a few different ways to do that but can’t seem to find a way to do it. Am I missing something simple, or is it harder than it sounds…?

---

<div class="post-metadata">

**Author:** ![Joe\_Gabriele](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/joe_gabriele/32/57595_2.png) [@Joe\_Gabriele](https://community.glideapps.com/u/Joe_Gabriele)\
**Post date:** [May 20, 2023, 8:09pm UTC](https://community.glideapps.com/t/leveraging-a-query-for-a-conditional-value/61966/2 "2023-05-20T20:09:02Z")

</div>

Without seeing your exact setup, can you try, If Query is not empty, Value A. If not, Column 1?

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [May 20, 2023, 9:54pm UTC](https://community.glideapps.com/t/leveraging-a-query-for-a-conditional-value/61966/3 "2023-05-20T21:54:40Z")

</div>

Thanks for the suggestion. Unfortunately, that doesn’t work because the Query returns values (the same values) in each row. So there are no empty rows for that column.

EDIT: but what did work is a second query, using the first query as the source and then filtering using the “query this row” feature. Now, using the second query, your method works.

---

<div class="post-metadata">

**Author:** ![Joe\_Gabriele](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/joe_gabriele/32/57595_2.png) [@Joe\_Gabriele](https://community.glideapps.com/u/Joe_Gabriele)\
**Post date:** [May 20, 2023, 10:40pm UTC](https://community.glideapps.com/t/leveraging-a-query-for-a-conditional-value/61966/4 "2023-05-20T22:40:36Z")

</div>

Yes, I was going to say that you could query a query. Or, could you just add a 3rd filter in your original Query and do an ITE column where if RowID is not included in Query, then ValueA?

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [May 21, 2023, 10:41pm UTC](https://community.glideapps.com/t/leveraging-a-query-for-a-conditional-value/61966/5 "2023-05-21T22:41:05Z")

</div>

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