Questions tagged [iif-function]

IIf is a language function to perform an immediate or inline conditional assignment.

IIf is an abbreviation variously for Inline If or Immediate If and is available in many programming and script languages, IIf is implemented as a Function which means it returns a value. In code, these typically take the form:

result = IIf(condition, TruePart, FalsePart)

The value of result afterwards depends on the evaluation of condition.

A multi-line If block could perform the same action but would be an If Statement. The statement form could include any number of other actions such as invoke other methods. On the other hand, IIf simply results in a conditional assignment and cannot invoke other code.

Some languages also support a 'conditional operator', sometimes called a ternary operator, which works similar to IIf, but may offer other benefits.

94 questions
0
votes
1 answer

SQL UPDATE IIF ,I deleted all my rows by accident :(

IN MS-ACCESS: I have a table RESTAURANTS that has a column Price I want to change the prices in the table based on these conditions: if the price is less than 25, add 10 to that price, if the price is 25 or over, I want to subtract 10 from that…
0
votes
1 answer

how to use if to test whether a value is in a list in mysql?

Below are part of the code in a procedure: if p_vendor_id is null then set v_msg := 'Error: parameters are not valid' elseif p_vendor_id not in (select vendor_id from p_plants.vendors) then set v_msg := 'Error: vendor id parameter is not…
PMa
  • 1,751
  • 7
  • 22
  • 28
0
votes
1 answer

Calculate Total based on Null Field

I have a database that creates Invoices based on Work Orders, by a "WOrderID". I have a section that calculates Subtotal - Payments = Amount Due. The payments are generated from another table which has the WOrderID and the Payment Amount. I want the…
Justin_DavieHigh
  • 225
  • 2
  • 7
  • 22
0
votes
2 answers

Choose ImageField.Picture based on the Value in Another Field

I am new to Access but, thanks to this great forum, I have learned a lot in the past few weeks. I am trying to make an image control to display one of three arrow images depending on a value of "1,2 or 3" in another field. The arrows represent…
D2rd
  • 11
  • 7
0
votes
1 answer

Too many arguments

I have the below piece of coding :- =IIf(IsNothing(((Sum(Fields!TotalCost.Value, "Accrued") + Sum(Fields!TotalCost.Value, "serv1")) / (Sum(Fields!Quantity.Value, "serv1") + Sum(Fields!Quantity.Value, "Accrued"))), (45),…
user1086159
  • 1,045
  • 5
  • 16
  • 24
0
votes
3 answers

SSRS expression issue using iif function

I have a data set that is returning two properties, a name and a total units. I am trying to set an iif expression on a data bar where iif(field!Name.Value = "Name", field!Total.Value, 0) this is not working I get an error of…
user2478694
  • 1
  • 1
  • 3
0
votes
1 answer

Is it possible to add/subtract in one cell, and have it subtract/add in another cell that already has a value?

Is it possible to add/subtract in one cell, and have it subtract/add in another cell that already has a value? I am thinking it may be a if function but I can not wrap my head around how I would write out the formula.
user2539292
  • 3
  • 1
  • 1
  • 2
0
votes
1 answer

change image in report builder using iif function

I'm working with sql server report builder and I'm trying to change the value of an image according to a chosen date from a parameter. I've selected external as source and in the expression window I have something like…
megara
  • 97
  • 2
  • 11
0
votes
1 answer

syntax error SQL Access Nested IIF ISNULL statements

I'm getting a syntax error, I've changed it multiple times, re-typed it and tried to draw a map even. Now after my head is about to expload, out of desperation I'm turning to someone who has an eye for this. I might be pushing it trying to grab…
Dm3k1
  • 187
  • 3
  • 8
  • 21
0
votes
1 answer

IIF Statement LogiXML

I am having problems trying to do the following. I am trying to incorporate an iif statement inside a caption. This is the current line that is evaluated on the label: =round(@ Data.rp_TATStatAtBenchmark~ / @ Data.rp_TATStatCount~ * 100) + "%" and…
Jose H.
  • 5
  • 2
-1
votes
1 answer

I need to make Access grades table

i need to create iif code for ms access, so if number count takes start from 0 and to 34 it will be F grade. Field Успішність is for count from 0-100 and field Оцінка is for grade from F (and Fx) to A. 0-34 F, 35-59 Fx, 60-63 E, 64-73 D, 74-81 C,…
-1
votes
1 answer

Where Clause Using Conditional Statement

i have query below SELECT @RoleUser = MR.Code FROM MasterRole MR INNER JOIN MasterUsersRole MUR ON MR.Id = MUR.RoleId INNER JOIN MasterUsers MU ON Mu.UserCode = MUR.UserCode WHERE MU.UserCode = @UserLoginID select 1 Num ,…
Brown_MV
  • 69
  • 5
-1
votes
1 answer

Choose correct PRODUCT COST from ROW based on amount sold

I am making a sheet to CALCULATE REAL REVENUE from each sale I make on my online store. The problem is that the COST of my products is not always constant. It varies depending on many factors so each time I make a purchase I add the NEW PRODUCTS…
-1
votes
2 answers

Function IIF, how to make it take 2N + 1 arguments of logical expressions?, C #

In Visual Basic, there is this IIF Function, as in Crystal Report, etc ... In C # itself, this function does not exist, but it is the same as doing something like this: bool a = true; string b = a ? "is_True" : "is_False"; But for the code to be a…
J. Rodríguez
  • 256
  • 1
  • 6
  • 21
-1
votes
1 answer

Blank cell in excel with iF FUNCTION

I'm trying to make a World Cup 2018 Excel sheet prediction for me and my friends. I have succeeded to make all the functions for example - I have one table that presents the real scores which are connected with a function to the other members…
BOB123
  • 176
  • 10