Questions tagged [select-case]
164 questions
1
vote
1 answer
Select Case conversion not displaying properly, how can i fix?
I have an executable that when run takes an inputted date and then selects what date suffix is needed with it, however it is always defaulting to the case else.
when i have 02/04/2017 as format DD/MM/YYYY the result of the below case is 2th April…

Danny James
- 244
- 3
- 16
1
vote
2 answers
Select Case on a range
I basically have multiple variables that I want to categorize. I have a list of which variable goes into which category however given I have 40,000 entries doing it manually would be timely.
Basically my data is such that a,b,c are in Group A,…

Isra Shaikh
- 151
- 2
- 4
- 12
1
vote
1 answer
how to use concat function in case statement using jpa criteria query
Iam concatenating string and expression in case statement when the condition is satisfied as below mentioned code.
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery

Bhagya Lakshmi
- 19
- 1
1
vote
4 answers
How can I do select case to this query?
SQL FIDDLE DEMO HERE
I have this structure of tables:
CREATE TABLE Users
([UserId] int,
[IdDepartment] int);
INSERT INTO Users
([UserId], [IdDepartment])
VALUES
(1, 5),
(2, 0),
…

Esraa_92
- 1,558
- 2
- 21
- 48
1
vote
1 answer
Visual Basic Case Select Inside For Next Stopping After First Iteration
This seems like a rather trivial thing to me and yet I can't get it to work. Does anyone have any idea why the code below simply returns a single message box with "z = 0"? Thank you so much for your help.
For z As Integer = 0 To 5
Select Case z
…

SunnyNonsense
- 410
- 3
- 22
1
vote
1 answer
Vb.NET - ' Case "String1" Or "String2" ' trying to convert "String2" to Long
A section of code I was updating used a select case statement to compare the value of a string...
I noticed that for two possible values, I could end up re-using the same bit of code.
So I added a case:
Case "Yes/No" Or "Continue"
However, when I…

schizoid04
- 888
- 1
- 11
- 27
1
vote
5 answers
Comparing the Oracle Interval Data Type
I have an oracle time interval in a select statement like this:
SELECT ...
CASE WHEN date1 - date2 > 0
THEN 'No'
ELSE 'YES'
END
This fails with an invalid data type. So I tried this, and it still fails.
SELECT ...
CASE WHEN…

jeffspost
- 339
- 3
- 6
- 14
1
vote
4 answers
Bash Shell Scripting - Select Case Menu Not Working
i'm quite new to shell programming.. and working on project
am doing Select Menu using the Select Case
below is the scripting
#! /usr/bin/bash
echo "1) Add new book"
echo "2) Remove existing book info"
echo "3) Update book info and…

Preeyah
- 363
- 3
- 16
- 42
1
vote
2 answers
for each word in textbox do this code
I have a problem with vb. I cant do this
For Each Letter As Char In TextBox1.Text
Select Case TextBox1.Text
Case "run"
'Code
Case "ok"
'Code
End Select
Next
so what it does is it repeats for the amount of…

Asking Questions
- 404
- 8
- 16
1
vote
1 answer
Combine multiple CASE statements into one and SELECT INTO temp table
I have a query that produces sepearate outputs. I need to combine the SELECT CASE statements into one and then have all outputs inserted into a Temp Table
SELECT CASE WHEN #WCV_3.VISIT_1 IS NULL THEN '' ELSE CONVERT(VARCHAR(10), #WCV_3.VISIT_1,110)…

IJ_05
- 21
- 1
- 7
1
vote
2 answers
Loop same case in select case in vb.net
I want to come up with this problem.... if there's only 1 false in loop then it will not insert into database and vise versa if all true then it will insert to database.
Here's is my code
Public Function Check_Foreign_Key(ByVal select_column_name As…

Denmark
- 538
- 2
- 8
- 26
1
vote
1 answer
Why there is a change in cyclomatic complexity when rearranging switch statements with other dependent factors?
The CC for the below method would be generated as 9
Public Enum Fruits
Apple
Pineapple
Banana
PassionFruit
Orange
Melon
Grape
Mango
End Enum
Private Function Fruity(ByVal…

kurozakura
- 2,339
- 8
- 28
- 41
1
vote
3 answers
Pass in Array to Select Case
this may be a dense question and I'm not finding it to be a dup of this one, but I need some help with understanding if an array can be used in a Select Case statement.
I have a sub routine that I will create a string array dynamically. The XML is…

Todd Main
- 28,951
- 11
- 82
- 146
1
vote
1 answer
Access 2010 VBA Select Case Statement
I am trying to build a function where based on a string comparison use a specific formula
The problem I have is that I get a Byref arguement type mismatch error
It must be something to do with passing the string for the comparison and also the…

Craigoh1
- 169
- 2
- 3
- 15
1
vote
2 answers
String.Contains not working as expected
I have 54,000 files each with a slightly different method of naming and I need to check whether the filename contains a particular string. However, I can't find a ways of getting a Select statement to work correctly.
My code fails unexpectedly.…

Penfound
- 43
- 1
- 7