Questions tagged [conditional]
Conditional has various meanings for various languages and probably should be avoided as a tag.
1
vote
2answers
25 views
Conditional rendering in React based on state
I'm sending an API request and render its result in to UI.
Now, for the error-handling, I wanted that if there is an error a div which contains an error message gets rendered in to the UI.
To ...
-1
votes
2answers
33 views
Max. revision of data entries in a MySQL multiple COUNT(CASE WHEN THEN END) conditional setting
Consider the following sample data set:
SELECT ID, patID, OP1Datum, OP1OPVerfahren, revision FROM table LIMIT 50;
+----+-------+------------+----------------+----------+
| ID | patID | OP1Datum | ...
-2
votes
4answers
34 views
If statements in loop (python)
I have 20 sectors and want to print my points per sector. With a bunch of if statements it looks like this:
if sector == 0:
print(1)
if sector == 1:
print(2)
if sector == 2:
print(3)
...
...
1
vote
1answer
20 views
How can I refer a laravel route to different api controllers based on type of the model type injected in the route?
I have an apiResource route whose URL contains a factory and a product model.
Depend on the product type, I need two different controllers. I also need to inject factory instance and product instance ...
0
votes
0answers
16 views
Can tf.cond() be used to dynamically define the graph
To build a test case code, I simply want to pass a tensor to a graph and have the model decide whether to multiply by 2 once or twice. The decision is based on evaluation of a boolean. Here is the ...
0
votes
1answer
16 views
How can I do a conditional statement so ajax fetchs the correct xml document
I have a simple code to fetch a xml file and display it as a drop down list. However, I would like to fetch the xml file according to a condition. If it equals to study1 then .ajax selects ctc3.xml, ...
0
votes
1answer
46 views
How to initialize variable / have increasing “rounds” in Java - Beginner, need assistance
I'm attempting to create a program that simulates a dice game in Java. There are two players that roll 3 dice each round, for six rounds. Various numbers give various points to each player, which ...
0
votes
2answers
32 views
Ansible: docker env conditional variable
Maybe I am approaching this the wrong way. I just started with Ansible and I couldn't solve this problem lately:
So this is a snippet of what I am trying to do:
vars:
var1: "true"
var2:...
-1
votes
2answers
39 views
Is it possible to use long string in conditional statement only once (without creation additional variable)?
Here is the thing: I'm getting very long hardcoded string and I have to check the length of this string using a conditional statement and if the statement is True, I have to assign that string to ...
0
votes
1answer
54 views
Conditional statement between columns and rows in dataframe
I'd like to create to column, that creates a value based on if-statement between values in the same row and, if needed, in the rows above.
I have a constant A and df
A = 0.5
FID_1 ...
1
vote
1answer
25 views
Conditional statement for move methods in BlueJ Java puzzle
I have to complete some methods to move across a room to exit. If you step on each spot, it turns a force field on or off. How would I write a conditional statement for the move method? Mine keeps ...
0
votes
1answer
11 views
if uninstall.exe exists run Uninstall step else jump to Install vNext build task
I have a release TFS build which has uninstall and install step of an application in my agent folder for further testing.
Unfortunately, when it happens to be fresh install in the agent directory it ...
0
votes
2answers
80 views
Conditional Operator: ? : is not working in c
I was working with conditionals in c. While coding I found that this code is not working
int x = 1;
printf(1>0? "%d",x : "0");
Now, 1 is obviously greater than 0. So the program should print the ...
0
votes
0answers
31 views
Get documents based on conditional query of fields in mongoose js
I am having model like this
const schema = new mongoose.Schema({
locationtype: String, // one of "all","locationstoshow","locationsnottoshow"
locations: [{
location_country: String,
...
0
votes
2answers
31 views
Remove rows with value below zero in the column in each list's dataframe in R
I have a large list with 12 elements (dataframes). Each dataframe has the same numer of rows and columns.
I would like to remove all rows which have in the column AMOUNT value < 0.
This has to ...
1
vote
2answers
23 views
Uing Vue.JS v-bind:class with conditional statement of dynamically created array
I have a table that is created when an array called shelves is created in my Vue app.
<table>
<tr v-for="(shelf, index) in shelves">
<td>
<input type="number" v-model=...
0
votes
0answers
11 views
Conditional bundling of javascript in Visual Studio
we provide a ERP with an e-commerce as a feature. Our customers can modify this e-commerce based on numerous options to their liking.
We are currently bundling all JS and CSS with "Bundler & ...
-2
votes
0answers
27 views
How to say if a pointer is not pointing to the head of the pointer in an conditional statement? [closed]
I was trying to make an if statement where the program does something if pTemp is not at the front and is not at the end. So this is what I have so far:
if((pTemp->next == nullptr) && (...
-1
votes
2answers
42 views
If-statements with grouped conditional operators
I have a code where I want an if statement with 3 conditions passed. However, in one of my conditions, I can allow either or.
For example, the if statement is true if( 5 && 6 && (7||...
-2
votes
2answers
67 views
How to create multiple if statements in JavaScript? (closed)
[Closed as both answers are working for this example, thanks!]
I'm getting values from a dynamic JSON file (that is getting it's values as an array from a sensor through an ESP8266) and and I'm ...
-1
votes
2answers
32 views
conditional statement working incorrectly-python
I have two scripts: rank.py and elo_7.py. The elo script pulls info from rank.
In elo_7.py:
...
elif player_1.age or player_2.age > 50 and abs(player_1.age-player_2.age) > 10:
(make some ...
0
votes
1answer
28 views
ORACLE - UPDATE each row conditionally (iterate table only once)
I have the following SELECT statement:
SELECT COUNT(*) FROM EPS_PROPOSAL
WHERE NSF_CODE = 14 OR
NSF_CODE = 5 OR
NSF_CODE = 3 OR
NSF_CODE = 45 OR
NSF_CODE = 11 OR
...
1
vote
0answers
13 views
How to correctly format the if statement for ie (lte 8 before another script) on sublime text 3 or really in any editor
Today I have a problem that I guess any newby bump up before or later in their career when they have to declare a conditional script to make something work on Internet Explorer.
Here's my code:
<!...
0
votes
0answers
28 views
Calling Arrayed Field to If Conditional Statement
In the admin section:
$options[] = array( "name" => esc_html__("Company IDs",'press'),
"desc" => esc_html__("add Company / eSports Team, User ID to post more than one listing.",'press'),
"id" =&...
0
votes
1answer
8 views
Using the grep search result of a SYSTEMCTL status into a IF CONDITION
First of all, thanks for looking into this!
I am very newbie at bash scripting what I am trying to achieve is:
I currently have to restart some services at my work quite often and I am trying to ...
0
votes
1answer
35 views
Check if variable has value the opposite way?
I have this PHP if statement that I am trying to firgure out.
I know what the result is, but I have not seen this before (probably my bad).
Who can help me understand the code below? Why is $a ...
-1
votes
0answers
7 views
How to delete elements already considered to match in a loop?
Please in matching values of two similar arrays using a for loop, how do I delete elements that meet the matching criteria for an element in the reference array so its mot matched twice.
1
vote
1answer
73 views
Conditional move instruction on a NULL check before dereferencing a pointer [duplicate]
I'm working on exercise 3.61 of CSAPP, which requires to write a very simple function that checks if a pointer is NULL before trying to dereference it, which should base on a conditional move ...
0
votes
0answers
48 views
How is my async throwing a “Conditional jump or move depends on uninitialized values”?
I'm trying to emulate a game server but, when I try to run my LoginServer asynchronously I'm given the "Conditional jump or move depends on uninitialized value(s)" error through Valgrind. However, if ...
0
votes
1answer
24 views
R Shiny conditional dateInput for every checkboxGroupInput selected
I am creating an app that allows the user to multi-select a list of projects. For each project selected, I would like to have a dateInput field to appear beside the project name (i.e. a/b/c).
...
0
votes
2answers
28 views
How to merge two dataframes with conditional statements
I have two df I want to merge.
df1 looks like this:
CODE TAX PRICE TOTAL
4577 0.9 99.1 100
8965 NA 25 25
7788 1.5 13.5 15
4021 NA 20 20
6987 0.00 40 ...
-1
votes
1answer
35 views
Transpose columns 5-8, every time the row value changes in columns 2, 3 or 4
here is my dataset
What I am trying to do is transpose the last 4 columns every time there is a new Tube (or new Colony or new Sample)
Therefore transforming into sth like this:
I ve been trying ...
0
votes
1answer
18 views
How to conditionally select a specific directory based on environment pom.xml
I have 2 files which are located in different directory. Based on the environment variable I need to select the files located in that respective directory.
For Example, I have required files for Non-...
0
votes
0answers
17 views
SSRS conditional statement
The logic is, If the type field is equal to 9, then the description field should be equal to Accounts. The 9 is present on the report, but the account description is not pulling. So I am trying to ...
1
vote
3answers
54 views
Multiple conditionals with %>%
This seems to be a questions which should be in stackoverflow/google, but it isn't (or at least I couldn't find it) so I will ask it here:
Reproducible example:
colnames(df)
"Z1" "Z2" "Z3" "...
1
vote
2answers
30 views
How to remove the whole simulation with the same conditions
I have a dataset:
Simulation Time BTC
1 1 0
1 2 0
1 3 0
2 1 23
2 2 45
2 3 55
I want R to delete all ...
1
vote
1answer
20 views
Run a conditional bash command inside of tox
I'm trying to run conditional bash commands in Tox.
If the user passes 'stag' into the script, tox should run one curl command; if they pass 'prod' into the script, it should run another curl command....
0
votes
2answers
22 views
?Is there a reason why my program won't perform it's if elif else statement after receiving proper input
Basically, the goal of this program is to take input from the user on what they want to order, process the cost of the item and tack on sales tax and a tip and return that. I'm struggling with how to ...
-1
votes
0answers
5 views
VBA help while field mapping from a raw data tab
So we have a system that helps brokers relay reports from our platform to excel. the data is read into the 'raw data' tab, and is then mapped over to the template sheet with specific formatting.
The ...
1
vote
1answer
23 views
Given the type “anything except function OR function”, how do I check if it's a function in TypeScript?
Why is the value not of type () => string after the if (typeof value === 'function') check?
What check should be made, so that the type is inferred correctly (making the cast unnecessary)?
...
0
votes
2answers
15 views
What is the Conditional Formatting formula for two conditions?
I have an excel file that I need to format a certain color.
I have tried:
=AND(A:A=FALSE,B:B<>Null)
=AND(A:A="FALSE",B:B<>" ")
=AND(A:A=FALSE,NOT(ISBLANK(B:B)))
Along with multiple If-...
1
vote
2answers
43 views
If else in ansible print statement
I would like some help with syntax for a print statment that has multiple conditions. Currently, the quotes for '{{inventory_hostname}}' is causing errors and if I remove the quotes the playbook runs ...
0
votes
2answers
27 views
How to loop through pandas dataframe, and conditionally assign values to a row of a variable?
I'm trying to loop through the 'vol' dataframe, and conditionally check if the sample_date is between certain dates. If it is, assign a value to another column.
Here's the following code I have:
vol ...
0
votes
2answers
20 views
Maximo Processing Rule
In Maximo 7.5, I need to add a processing rule to a publish channel that will skip records where the laborcode starts with 99. However, simply using a LIKE evaluation type with a value of 99 will ...
-1
votes
1answer
52 views
How to prevent unwanted variable assignment inside condition statement?
Missing equal sign inside assignment (typing = instead of ==) make unwanted assignment inside a condition statement.
For example, consider the scenario below (this example is in C, but the question ...
0
votes
1answer
22 views
MongoDB sorting by condition
Hello guys i'm stuck in one condition where i need to sort the data that matches some conditions and then sort them by it's priority bases i.e
first i want to sort the data via it's priority in ...
0
votes
2answers
28 views
Setting condition for max within mutate function of dplyr
I am looking to determine the max score within a data set but only when looking the group population is above a certain threshold, in this case above 20. sample data:
Race = c("African American", "...
3
votes
1answer
40 views
Panda dataframe conditional change
I'm working on csv time series data, which shows count of step per some time frame. Once the step count is exceeding 65535, it will count start from 0, etc. However since not all the dataset has 65535 ...
1
vote
1answer
24 views
Show content based on whether the user has certain tag in Mailchimp
I went through the Merge Tags here and here, but couldn't figure out the syntax that would allow me to show content based on whether the user has certain Tag or not.
Help?
My goal in case it helps:
...
1
vote
2answers
37 views
PowerShell switch statement with conditionals
How to have conditionals in a PowerShell switch statement? This code below returns 0 when it should return 1000.
$UsedSpaceMB = 8500
switch ($UsedSpaceMB) {
($UsedSpaceMB -gt 15000) { $FreeSpace ...