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
2
votes
1 answer

Autofill parts description via parts number text box

Sorry i don't have any code written because i have never written vba in access before. what i need to do is have a combobox autofill on my form to save a bit of time i have a database that has all our parts that includes [parts number] [parts…
Matthew Macri
  • 89
  • 2
  • 14
2
votes
3 answers

vb.net: how is iif giving a null reference exception?

Been looking at a lot of post/articles about using Iif(). All of this started when I tried to use IIf() like a conditional operator much in the likes of C/C#/C++ etc. What I tried to do exactly was exactly in the lines of this of the following…
deostroll
  • 11,661
  • 21
  • 90
  • 161
2
votes
1 answer

Can i execute query in iif function

I want to know can i run a query in iif function used in ms access database. My case Select field1,(iif(3<4,'Select * from tbl1','select * from tbl2')) from tblmain I am facing syntax error when i try to executed query like that whats the problem
Fraz Sundal
  • 10,288
  • 22
  • 81
  • 132
2
votes
2 answers

How to use Joins in IIF() function and how to use select statement inside nested IIF () in MSAccess query?

I came to know that one can't use case expressions in Ms-access queries. Instead one has to use IIF() function. I have a MS SQL query which needed to convert to Ms-access query for one of the pre-existing old Legacy application. I know the general…
toofaced
  • 141
  • 4
  • 18
2
votes
1 answer

IIF Statement in TablixFilter issue

I'm trying to filter a matrix in my report. I have names of 4 drivers and I want the Matrix5 to show the name of a default driver in case SELECT ALL is checked in filter. Otherwise I want the matrix to show whoever is checked. I set an expression at…
Ege Bayrak
  • 1,139
  • 3
  • 20
  • 49
2
votes
2 answers

SSRS Avg function returns result that is different than expected

Currently I am trying to average a set of numbers, but with certain conditions. Is it possible to use an iif() within an avg() and return the correct result? Furthermore, as of now my computations return a decimal returned to a power (8.9267....E…
Ryan
  • 414
  • 1
  • 5
  • 16
2
votes
3 answers

SSRS - nested IIF in the expression

=iif((Fields!Company_OEM.Value = "Channel") AND (Parameters!paramCompanyOEM.Count < 2), "None", iif(Not(Fields!Company_OEM="Channel"), Count(Fields!TS_ISSUEID.Value), "None")) Error shows and unable to run the report Suppose the conditions (first…
Mohan
  • 29
  • 1
  • 2
  • 8
1
vote
3 answers

Report Server - unable to display correct input parameter via Iif() or Switch()

I have a nullable boolean input parameter with the following expression in my textbox: =iif(Parameters!Sorted.Value="","All",iif(Parameters!Sorted.Value="True","Sorted","Unsorted")) and I am trying to display this based on the value of Sorted input…
Neomoon
  • 181
  • 1
  • 3
  • 12
1
vote
2 answers

Access IIF Query

I need my Final Decision field to be the result of the IIF statement. But I keep getting syntax errors. SELECT x.AR_ID, Final Decision: IIf([x].[R_DECISION] Is Not Null, [R_DECISION], …
Madam Zu Zu
  • 6,437
  • 19
  • 83
  • 129
1
vote
1 answer

informatica : why i am getting error while using iif function?

I have column 'GENDER' where values 'M or 'F' comes in , anyother value coming, i want to populate as 'UNK' using IIF in expression tranf informatica. i am getting error operand cannot be converted to number using below expression iif(GENDER='M'…
kumar
  • 37
  • 7
1
vote
2 answers

JavaScript: Is there a reason that console.log works but not return?

I am trying to get a checkbox to return 1 or 0 depending upon if it is checked or not. I am having a hard time understanding why the return in this if function is not working. If I used console.log instead of return the output is correct. 1 when…
1
vote
0 answers

IIf vs if-else in VBA

I couldn't find anything specific for VBA but as far as I checked the answers (for other languages) in VBA this code If A then B else C is essentially the same as IIf(A,B,C) The only difference is that the IIF-function is a little more compact. I…
Albin
  • 1,000
  • 1
  • 11
  • 33
1
vote
1 answer

IIf Function Based on User Defined Parameters

I'm trying to develop a query based on parameters entered into a form. I want to make sure that the query will still work even if the user chooses not to enter parameters (ex. start and end date) or if the user only enters half of the parameters…
Bethany
  • 11
  • 1
1
vote
1 answer

Access IIF statement to list results

In Access 2010 I'm trying to list the results from my IIF statement but for some reason is not working. DogTrainingStatus: IIf(([TrainingSuccess]>"*Pass*") And ([TrainingSuccess]>"*Failed*"),"Failed", IIf([TrainingSuccess]>"Failed","Failed","…
MochaV
  • 19
  • 5
1
vote
2 answers

Error in SSRS expression for false condition

I want to generate my string in the following format: Vancouer should be displayed as -> ( V) anc-ouer Roberts Cut-Off Road -> Roberts Cu(t-O) ff-Road ... etc So for the last 4 charaters I am using: Right(Fields!NAME.Value, 4) for the middle…