I have this logic in vensim that goes,
If result<150, 1,2
if result>=150 :AND: <200, 3, 4
If result > 200, 5, 6
What I want is to make them nested if in vensim, but I do not know how.
I already tried
If then else (result<150, 1, If then else (result>=150:AND:<200,3, 2))
but it doesnt work. please help
Related
I used the following statement to filter records by subject ids. (Here subject_id=5)
$this->datatables->where('letter_letter.subject_id', 5);
That is working perfectly. Further I want to filter records in subject_id range like 1 to 10. Then I changed my code as follows :
$this->datatables->where('letter_letter.subject', 10, '<');
But did not get the desired output. How can I edit my code to get expected result ? Can anyone help me ?
Just use two calls to where() to define the range:
$this->datatables->where('letter_letter.subject_id >= ', 1);
$this->datatables->where('letter_letter.subject_id <=', 10);
This is one way you can make a where query with two conditions:
$this->datatables->where("letter_letter.subject_id IS ? AND letter_letter.subject BETWEEN ? AND ?", 5, 1, 10)
I need to sum this expression
= IIf(Fields!SupplyStrategyTypeName.Value="Supply",0,
IIf(Fields!IP_DA_FIN.Value>225,Fields!IP_DA_FIN.Value-225,0))
I tried following the example of the previous question but I get an error.
Any help on this?
You didn't list what you tried or the error you got so here's what should work:
=SUM(IIf(Fields!SupplyStrategyTypeName.Value = "Supply", 0,
IIf(Fields!IP_DA_FIN.Value > 225, Fields!IP_DA_FIN.Value - 225, 0)) )
So if a row of data's SupplyStrategyTypeName is Supply or IP_DA_FIN is 225 or less, it would result in 0 otherwise it would be IP_DA_FIN - 225. Then the sum will sum all the results.
Don't be worried about using too many spaces - they make it more readable when you go back through your formulas to figure out what's wrong.
I want to print my list in order, but it keeps printing the first value
def print_order(s):
if not s:
return
print(s[0])
print_order(s[:-1])
for example I have a list [1, 2, 3, 4, 5, 6, 7] I want it to be
printed out as
1
2
3
4
5
6
7
You are taking the last element off instead of the first. Try changing the recursive call's argument to s[1:].
The slice s[:-1] is all elements except the last.
You want s[1:], which is all elements except the first.
I am creating a field from tables with our shoretel phone system and i am intergrating reports via SSRS and i need some assisstance with an expression.
=if(Fields!ExitReason.Value 7,
then if (Fields!ExitReason.Value 1,
else if (Fields!ExitReason.Value 0,)))
Definition results should be:
=if(Fields!ExitReason.Value) = 7 then 1 else 0
I am try to get the field to give me 7, 1 else 0. Any assistance would be great.
Thanks,
Arron
You should be able to use
IIF(Fields!ExitReason.Value = 7, 1, 0)
http://msdn.microsoft.com/en-us/library/ms157328.aspx
can anyone help please. I need to put an IIf within an IIf within an IIf. I have a parameter called 'Period' with 4 labels, '24 Hrs, 3 Days, 7 Days, Month'. I have another Parameter ('Date' and hidden) containing the following DateSerial
'=DateSerial( Datepart("YYYY",Now()),Datepart("m",Now()),Datepart("d",Now())-1 )'
which the parameter Period defaults to on opening e.g. 20/10/2009 07:00
The third Parameter ('Date From' also hidden) is where I want to put the nested IIfs. I want it to read from the Parameter 'Period' and depending on the selection will depend on outcome, my code so far looks like this (not completed yet as I want to see if the first two IIfs work:
'IIf(Parameters!Period.Value = 1, DateAdd("h", 7, Parameters!Date.Value),
IIf(Parameters!Period.Value = 2, DateAdd("h", -41, Parameters!Date.Value)))
Can anyone tell me where I am going wrong.
Regards, Althea
You need a "else" value in the second IIf just in case your Period is neither 1 nor 2:
=IIf(Parameters!Period.Value = 1,
DateAdd("h", 7, Parameters!Date.Value),
IIf(Parameters!Period.Value = 2,
DateAdd("h", -41, Parameters!Date.Value),
Parameters!Date.Value)) ' If period is neither 1 nor 2 just return the date