# Dropdown menu Issue

**URL:** <https://forum.inductiveautomation.com/t/dropdown-menu-issue/10169>\
**Category:** Ignition\
**Created:** [June 24, 2015, 5:48pm UTC](https://forum.inductiveautomation.com/t/dropdown-menu-issue/10169 "2015-06-24T17:48:42Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![Mr.K001](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Mr.K001](https://forum.inductiveautomation.com/u/Mr.K001)\
**Post date:** [June 29, 2015, 5:43pm UTC](https://forum.inductiveautomation.com/t/dropdown-menu-issue/10169/21 "2015-06-29T17:43:29Z")

</div>

Ok so this is weird, i decided to do the same method on a different data base, it works just fine, drop down menu works and sorts based on my selection, the only thing doesn’t work is the “all” option, when clicked it shows nothing. what can cause that?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [June 29, 2015, 6:06pm UTC](https://forum.inductiveautomation.com/t/dropdown-menu-issue/10169/22 "2015-06-29T18:06:43Z")

</div>

If you still have the shift binding like this:

`switch({Root Container.Dropdown.selectedLabel},
      "A","B","All",
      "AND twelve_hour_shifts = 'A'",
      "AND twelve_hour_shifts = 'B'",
      "AND twelve_hour_shifts = 'A' && 'B'",
      "")`

It may need to go back to:

`switch({Root Container.Dropdown.selectedLabel},
      "A","B","All",
      "AND twelve_hour_shifts = 'A'",
      "AND twelve_hour_shifts = 'B'",
      "")`

---

<div class="post-metadata">

**Author:** ![Mr.K001](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Mr.K001](https://forum.inductiveautomation.com/u/Mr.K001)\
**Post date:** [June 29, 2015, 6:17pm UTC](https://forum.inductiveautomation.com/t/dropdown-menu-issue/10169/23 "2015-06-29T18:17:56Z")

</div>

What troubles me is why the drop down menu stops functioning, I mean its obviously working when changing that values from A to B or back to A, it sorts the table correctly but needs to be done manually not through the drop down since that thing stops working and can’t make any selections.

---

<div class="post-metadata">

**Author:** ![Mr.K001](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Mr.K001](https://forum.inductiveautomation.com/u/Mr.K001)\
**Post date:** [July 3, 2015, 2:26pm UTC](https://forum.inductiveautomation.com/t/dropdown-menu-issue/10169/24 "2015-07-03T14:26:45Z")

</div>

Hey Jordan, so how about a different approach, what if I just create the drop down and don't give it a property instead just go in the dataset viewer of the drop down and add 3 labels, A,B,All and give them values of 0,1,2 now my question is, can you possibly mix expression with query? or is there a way to use IF ELSE in my query? I was thinking about using something like this:

> [@](#):
>
> SELECT Current\_Part\_Number, Current\_Running\_Percentage, On\_Time\_Percentage, Over\_Cycle\_Time, Over\_seconds\_for\_current\_part, t\_stamp, twelve\_hour\_Shifts, Total\_Part\_CycleTime, Color\_Code FROM JK\_LH\_Monthly  
> WHERE twelve\_hour\_Shifts = 'A'  
> UNION
> 
> SELECT Current\_Part\_Number, Current\_Running\_Percentage, On\_Time\_Percentage, Over\_Cycle\_Time, Over\_seconds\_for\_current\_part, t\_stamp, twelve\_hour\_Shifts, Total\_Part\_CycleTime, Color\_Code FROM JK\_LH\_Monthly  
> WHERE twelve\_hour\_Shifts = 'B'  
> UNION
> 
> SELECT Current\_Part\_Number, Current\_Running\_Percentage, On\_Time\_Percentage, Over\_Cycle\_Time, Over\_seconds\_for\_current\_part, t\_stamp, twelve\_hour\_Shifts, Total\_Part\_CycleTime, Color\_Code FROM JK\_LH\_Monthly  
> WHERE twelve\_hour\_Shifts = 'C'  
> UNION
> 
> SELECT Current\_Part\_Number, Current\_Running\_Percentage, On\_Time\_Percentage, Over\_Cycle\_Time, Over\_seconds\_for\_current\_part, t\_stamp, twelve\_hour\_Shifts, Total\_Part\_CycleTime, Color\_Code FROM JK\_LH\_Monthly  
> WHERE twelve\_hour\_Shifts = 'All'

I was looking around and looks like you can use "Case" to work like IF ELSE but never used it before... maybe something like:

```auto
SELECT Current_Part_Number, Current_Running_Percentage, On_Time_Percentage, Over_Cycle_Time, Over_seconds_for_current_part, t_stamp, twelve_hour_Shifts, Total_Part_CycleTime, Color_Code

    CASE
        WHEN (twelve_hour_Shifts = 'A') 
            
        WHEN (twelve_hour_Shifts = 'B') 
            
        WHEN (twelve_hour_Shifts = 'C') 
            
        ELSE twelve_hour_Shifts = All' 
    END 
FROM
    JK_LH_Monthly
```

Am i on the right track?

---

<div class="post-metadata">

**Author:** ![Mr.K001](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Mr.K001](https://forum.inductiveautomation.com/u/Mr.K001)\
**Post date:** [July 8, 2015, 3:44pm UTC](https://forum.inductiveautomation.com/t/dropdown-menu-issue/10169/25 "2015-07-08T15:44:50Z")

</div>

Ok so i took a different approach, I added A,B,C,All to my drop down data set since those are all the options available and then did this query:

```auto
SELECT 
	t_stamp,
	Current_Part_Number, 
	twelve_hour_Shifts,
	 
FROM JK_LH_Monthly
WHERE
	twelve_hour_Shifts = '{Root Container.Dropdown.selectedStringValue}' AND (t_stamp BETWEEN '{Root Container.Day.date}' AND '{Root Container.Day 1.date}
```

this works perfect if I select A or B or C, the only problem I have is when i select “All” since there is not such entry in the shift column so it shows blank. any suggestions? maybe say above code is good but if [code]  
twelve\_hour\_Shifts = ‘All’ then

SELECT  
t\_stamp,  
Current\_Part\_Number,  
twelve\_hour\_Shifts,

FROM JK\_LH\_Monthly  
WHERE  
t\_stamp BETWEEN ‘{Root Container.Day.date}’ AND '{Root Container.Day 1.date}

[/code]  
Which will give me everything , Shift A,B,C all together.

---

<div class="post-metadata">

**Author:** ![Mr.K001](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Mr.K001](https://forum.inductiveautomation.com/u/Mr.K001)\
**Post date:** [July 8, 2015, 6:34pm UTC](https://forum.inductiveautomation.com/t/dropdown-menu-issue/10169/26 "2015-07-08T18:34:40Z")

</div>

Another Update for those who maybe curious on how this works(I used the approach i mentioned in my last post above), got it figured out. this is the query i used on the table and the drop down works like a charm.

```auto

if('{Root Container.Dropdown.selectedStringValue}' = 'All')
	SELECT 
		t_stamp,
		Current_Part_Number, 
		twelve_hour_Shifts,
		
	FROM 
     JK_LH_Monthly
	WHERE
		t_stamp BETWEEN '{Root Container.Day.date}' AND '{Root Container.Day 1.date}';
	
	Else 
		SELECT 
			t_stamp,
	      Current_Part_Number, 
	      twelve_hour_Shifts,
		FROM 
             JK_LH_Monthly
		WHERE
			twelve_hour_Shifts = '{Root Container.Dropdown.selectedStringValue}' AND 
(t_stamp BETWEEN '{Root Container.Day.date}' AND '{Root Container.Day 1.date}');
	
```

Thanks for all the help! much appreciated!

[Previous page](https://forum.inductiveautomation.com/t/dropdown-menu-issue/10169.md?page=1)
