# Populating a dropdown from a Query String

**URL:** <https://forum.inductiveautomation.com/t/populating-a-dropdown-from-a-query-string/110622>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [September 15, 2025, 8:58am UTC](https://forum.inductiveautomation.com/t/populating-a-dropdown-from-a-query-string/110622 "2025-09-15T08:58:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roisin\_McGuire](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/roisin_mcguire/32/63343_2.png) [@Roisin\_McGuire](https://forum.inductiveautomation.com/u/Roisin_McGuire)\
**Post date:** [September 15, 2025, 8:58am UTC](https://forum.inductiveautomation.com/t/populating-a-dropdown-from-a-query-string/110622/1 "2025-09-15T08:58:38Z")

</div>

I have a large table of Part Numbers, I have columns for machine models populated with Yes/No depending on whether they contain said Part Numbers. I would like to populate a dropdown with all the part numbers that a given model uses. I thought I could parameterize this with either a Value or QueryString but I’m missing something, mini table for example:

```sql
CREATE TABLE testModel (testModID INT IDENTITY NOT NULL, PartName varchar(10), Model1 varchar(5), Model2 varchar(5), Model3 varchar(5), Model4 varchar(5), Model5 varchar(5));

insert into testModel(PartName, Model1, Model2, Model3, Model4, Model5)
VALUES
('Pump 264', 'Yes', 'Yes', 'Yes', 'Yes', 'No'),
('Pump 300', 'No', 'No', 'No', 'No', 'Yes'),
('Valve 24', 'Yes', 'Yes', 'Yes', 'Yes', 'Yes'),
('800 Lens', 'Yes', 'No', 'Yes', 'No', 'No'),
('Steel Fr', 'Yes', 'Yes', 'Yes', 'Yes', 'Yes'),
('Sil Seal', 'Yes', 'Yes', 'Yes', 'Yes', 'No');

Select PartName from testModel
WHERE Model1 = 'Yes' 

```

I would like to replace Model1 from example with a parameter for any Model column. I have tried a few variations of setting a Value or QueryString parameter but I think it’s the WHERE that is tripping me up:

```sql
SELECT PartName FROM testModel WHERE :getModel = 'Yes'

```

```sql
SELECT PartName FROM testModel WHERE '{getModel}' = 'Yes'

```

 ![getModel](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/a/8ad6422935647ca50ceac471c4dc81dff035dbcb.jpeg)

Appreciate any help, thanks

---

<div class="post-metadata">

**Author:** ![nikhilfarande3](https://avatars.discourse-cdn.com/v4/letter/n/4da419/32.png) [@nikhilfarande3](https://forum.inductiveautomation.com/u/nikhilfarande3)\
**Post date:** [September 15, 2025, 10:24am UTC](https://forum.inductiveautomation.com/t/populating-a-dropdown-from-a-query-string/110622/2 "2025-09-15T10:24:01Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/1/41a1c27f509672cd91aa656b732c72bd8be7c993.png)

you can use scripting like this

---

<div class="post-metadata">

**Author:** ![Roisin\_McGuire](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/roisin_mcguire/32/63343_2.png) [@Roisin\_McGuire](https://forum.inductiveautomation.com/u/Roisin_McGuire)\
**Post date:** [September 15, 2025, 10:49am UTC](https://forum.inductiveautomation.com/t/populating-a-dropdown-from-a-query-string/110622/3 "2025-09-15T10:49:54Z")

</div>

thanks very much, I'll give that a try

---

<div class="post-metadata">

**Author:** ![schenk](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@schenk](https://forum.inductiveautomation.com/u/schenk)\
**Post date:** [September 15, 2025, 10:50am UTC](https://forum.inductiveautomation.com/t/populating-a-dropdown-from-a-query-string/110622/4 "2025-09-15T10:50:57Z")

</div>

With that table structure and a fixed number of models, you could do something like this:

```python
SELECT
	PartName
FROM
	testModel
WHERE
	(:model = 1 AND Model1 = 'Yes') OR
	(:model = 2 AND Model2 = 'Yes') OR
	(:model = 3 AND Model3 = 'Yes') OR
	(:model = 4 AND Model4 = 'Yes') OR
	(:model = 5 AND Model5 = 'Yes')

```

If the number of models is going to change, I would consider restructuring this to separate Part and Model tables.

---

<div class="post-metadata">

**Author:** ![Roisin\_McGuire](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/roisin_mcguire/32/63343_2.png) [@Roisin\_McGuire](https://forum.inductiveautomation.com/u/Roisin_McGuire)\
**Post date:** [September 15, 2025, 11:06am UTC](https://forum.inductiveautomation.com/t/populating-a-dropdown-from-a-query-string/110622/5 "2025-09-15T11:06:08Z")

</div>

Yeah there will be more models and parts in the future so i might be better reformatting the source tables, thank you very much

---

<div class="post-metadata">

**Author:** ![tgarrison](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tgarrison/32/80965_2.png) [@tgarrison](https://forum.inductiveautomation.com/u/tgarrison)\
**Post date:** [September 15, 2025, 11:54am UTC](https://forum.inductiveautomation.com/t/populating-a-dropdown-from-a-query-string/110622/6 "2025-09-15T11:54:27Z")

</div>

You’re almost there. Querystring is what you want. But remove the ‘ ‘ from the {getModel}. They show them in the example in the docs because they’re using the querystring call on the value side, and they’re looking at a string.

Basically, just get it to work without the parameter, and then replace the columnname with the querstring parameter.

---

<div class="post-metadata">

**Author:** ![Roisin\_McGuire](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/roisin_mcguire/32/63343_2.png) [@Roisin\_McGuire](https://forum.inductiveautomation.com/u/Roisin_McGuire)\
**Post date:** [September 15, 2025, 2:49pm UTC](https://forum.inductiveautomation.com/t/populating-a-dropdown-from-a-query-string/110622/7 "2025-09-15T14:49:52Z")

</div>

oh I was being too literal, thanks
