All Questions
Tagged with switch-statement conditional-statements
147
questions
1
vote
1
answer
123
views
how to use switch case statement to filter result set based on condition in c#
i am working on a task where i am sending a status as parameter in request and want to filter based on that status and one other column from database table but that is not passed from request.
so it ...
0
votes
0
answers
86
views
Conditional Dropdown for Shopify cart checkout
This is all for a Shopify shopping cart check out page.
I am attempting to create a color choice selection in a conditional dropdown series. Where if in the first dropdown you select "Random"...
0
votes
4
answers
357
views
Match condition to key on an object and return its value
I came across a code in GitHub like this :
function typeToIcon(type) {
return {
success: 'check',
info: 'info-circle',
warning: 'exclamation-circle',
error: 'exclamation-triangle'...
0
votes
2
answers
176
views
Ruby Application using When/Case yielding Nil when it shouldn't
The following code should print one of the three options given depending on the results of any of the == checks, but it doesn't. It yields nil for any value of your_message provided via gets.chomp. ...
1
vote
2
answers
598
views
Java program using switch case seasons of the year getting error
I am trying out a program, below are the details
Write a program to take a month number and print if it is summer,
winter,rainy season Month number - 1 to 12. Let's assume Winter:
Nov, Dec, Feb, ...
-1
votes
2
answers
92
views
Rock paper scissors generating undefined values
In the code below I keep getting undefined values. Can someone explain why this is happening?
In this code I utilize math.random to generate a number between 0-0.99. Than I multiply it by three. After ...
-1
votes
4
answers
361
views
Instantiate specific class object depending on $variable value without using conditions
I would want to write the following code without switch, if else or the ternary operator. The code is shown below:
switch (type){
case 'bed':
function create{
return new Bed($customer, $...
0
votes
0
answers
22
views
how can i convert my query in laravel 8 and 2 counts with out switch case
SELECT districts.district_name AS District,
facilities.facility_name AS Name_Of_Health_Facility,
COUNT(beneficiaries.name) AS No_Of_Registered_Client,
COUNT(compliance_visits.facility_id) AS ...
0
votes
1
answer
673
views
Multiple conditional emails sent based on Google Form submission
I use the below script with a google form which sends an email to different people based on the answer chosen on the form. The script works and sends an email to the correct person when I use it with ...
-1
votes
3
answers
131
views
Weight Unit Converter in R
Is there a way to create a function in r which takes in the value to convert, the input weight unit and output weight unit?
converter<-fuction(value_in, unit_in, unit_out){
#some code
...
0
votes
1
answer
407
views
return only values from a categorical variable after filtering values from a calculation in powerbi dax
I have the following table created by a calculated measure:
+---------+-------+
| col| %_calc|
+---------+-------+
| personID| 0.93|
| empNO| 0.36|
| gender| 0.65|
| address| 0.55|
|...
0
votes
1
answer
696
views
Laravel Eloquent with condition
Can anyone help me ?
I have eloquent like this
$data = DocumentFile::with(['document_folder', 'document_request.user.profile'])
->where('isactive', true)
->when($request->...
0
votes
2
answers
497
views
Missing column names and case_when
Can you suggest a workaround for this error I'm triggering? (in R 3.6.2)
Using a case_when in a mutate, trying to test if a column is present, and only then use its value:
library(tidyverse)
aCaseFn &...
0
votes
1
answer
1k
views
How to include a condition inside a string using Javascript
I know for singular results, I can do something like this:
return "this is a condition test within a string - " + {0:'⚪',1:'🟡',2:'🔴',3:'🟢',8:'',...
0
votes
1
answer
254
views
Advanced Switch statement
I want to loop through an array of projects, filter out elements with multiple conditions, and push them to the destinated array.
The result should have 4 arrays containing all the projects that met ...