Thanks in advance for helping with this.
I have an issue where this I need the following formula to calculate this- i would advise seeing the picture in the link to fully understand the question (as I'm probably not going to explain myself!);
Calculating Risk Score
Condition 1: If Blood Result is less <=9 or Score <=6 or Tumour Size = <5mm show as text value Low
Condition 2 : If Blood Result 10-20 or Score = 7 or Tumour Size 5mm-9mm show as text value Medium
Condition 3: If Blood Result >=20 or Score = 8 or Tumour Size >=10mm show as text value High
The issue I am having is that any person can have a value from any of the condition, but I need to display the overriding value.
Example:
Blood Result = 5 (condition 1)
Score = 7 (condition 2)
Tumour Size = 10mm (condition 3)
SHOW VALUE: HIGH.
The problemn i'm having is that when I'm doing IF statements, as condition 1 of blood result is True, its always displaying Low without looking at the other values which could overwrite it.
I have only tried nested IF statements with AND OR in them, but no luck.
See examples of values
you can do one thing for that type condition
store your message in one variable, for example, var = msg
if condition 1 true assign msg = "Low"
if condition 2 true assign msg = "Medium"
if condition 3 true assign msg = "High"
after checking all conditions print your message.
I hope this will help you
Related
I have a question that confused me for a long time. As you know, when we use an if condition in Modelica, that means if the expression is true, then Modelica will do the corresponding equation.
But when i test the following code, I am confused:
model Model134
Real a(start = 0);
equation
if not sample(0, 2) then
a = 1;
else
a = 3;
end if;
end Model134;
I think a will be changed every 2s (start time=0), but when I simulate this model, it dose not change and a is equal to 1 all the time.
Dose anybody know the root cause?
a does change its value, but depending on your simulation tool you might not see it in the plot.
sample(0, 2) creates a time event every 2 seconds. The return value of sample() is only true during the event. So the value of a changes, but after the event it immediately changes back.
In this answer to a similar question, it is mentioned that Dymola stores the value before and after the event in result file. Intermediate values are skipped for efficiency reasons (there can be many for every event, which would bloat up your result file). Hence you can not plot this change in Dymola. For OpenModelica see the answer by
Akhil Nandan.
To proof that a really does change its value you can use this code for example:
model Model134
import Modelica.Utilities.Streams.print;
Real a;
equation
if sample(0, 2) then
a = 1;
else
a = 0;
end if;
when a > 0.5 then
print("a is " + String(a) + " at t=" + String(time) + "s");
end when;
annotation (experiment(StopTime=10));
end Model134;
You should see something like this in the simulation log:
a is 1 at t=2s
a is 1 at t=4s
a is 1 at t=6s
a is 1 at t=8s
a is 1 at t=10s
This is the plot simulated when trying your above code in OpenModelica with settings shown in the second figure.
A time event is triggered when sample(startTime,interval) evaluates true at every multiple of 2 seconds and based on your code logic this should activate else
block and assign value of variable a to be 3.
I am getting two values one is printing Cash and other is printing CASH in sap crystal report. Now, I want that wherever Cash is showing at that time value should be false while if CASH is printing then the value should show true. So, for that I added the formula but didnt work,
here is my formula,
if(ProperCase({TmpSalesBillInstallmentReport.PaymentType}) = true)
then {TmpSalesBillInstallmentReport.PaymentType}= '0'
else if(UpperCase({TmpSalesBillInstallmentReport.PaymentType}) = true)
{TmpSalesBillInstallmentReport.PaymentType} = '1'
This formula is not working, even getting error i.e. A Boolean Is Required Here(indicating on the first line)
I surfing in net but didnt get related question also.
IF {TmpSalesBillInstallmentReport.PaymentType} = "CASH" Then True ELSE False;
Note: A Crystal formula cannot assign a value to a database field. The field value is Read Only!
UpperCase() function is not a test that returns true or false. It simply returns the text argument after converting it to all upper case.
You might have a setting causing comparisons to be case insensitive.
See: http://www.plumblineconsulting.com/crystal-reports-and-case-sensitivity-of-database-records/
I'm am exploring methods of giving scores to different datapoints within a dataset. These points come from a mix of numbers and text string attributes looking for certain characteristics, e.g. if Col. A contains more than X number of "|", then give it a 1. If not, it gets a 0 for that category. I also have some that give the point when the value is >X.
I have been trying to do this with =IF, for example, =IF([sheet] = [Text], "1","0").
I can get it to give me 1 or 0, but I am unable to get a point total with sum.
I have tried changing the formatting of the text to both "number", "plain text", and have left it as automatic, but I can't get it to sum. Thoughts? Is there maybe a better way to do this?
FWIW - I'm trying to score based on about 12 factors.
Best,
Alex
The issue here might be that you're having the cell evaluate to either the string "0" or the string "1" rather than the number 0 or the number 1. That would explain why you're seeing the right things but the math isn't coming out right - the cell contents look like numbers, but they're really text, which the summation would then ignore.
One option would be to drop the quotation marks and write something like this:
=IF(condition, 1, 0)
This has the condition evaluate to 1 if it's true and 0 if it's false.
Alternatively, you could write something like this:
=(condition) * 1
This will take the boolean TRUE or FALSE returned by condition and convert it to either the numeric value 1 (true) or the numeric value 0 (false).
I am working in SharePoint 2013. I am trying evaluate the work of my staff and will be using a list to track this and want to assign a grade to the results. If the person gets a 4 out of 5 I want them to receive 80%.
The way I'm doing this is with a list that contains 5 questions with a drop down menu and the response are Yes, No, N/A. There is a second 5 columns that converts the drop down list selection to a 1, 0, or "Empty Record". Yes=1, No=0, N/A=Empty. This is an how I'm converting the responses to numbers: =IF([Question1]="Yes",3,IF([Question1]="N/A"," ",0))
So a response of (Yes, Yes, No, Yes, Yes) should convert to (1, 1, 0, 1, 1) which should = 4 out of 5. (80%)
The problem is how to calculate the grade so that if the an empty record doesn't factor into the calculation.
So a response of (Yes, Yes, No, Yes, N/A) should convert to (1, 1, 0, 1) which should = 3 out of 4. (75%)
I've got the conversion of the responses to numbers down pat, just can't get the calculation of the grade to work.
A True value is 1 and a False value is 0
So you can count the Yes strings (true) and the NOT N/A strings (number of Yes/No answers)
No need for any intermediate Calculations, all in one Column
=INT(AND(A1="Yes")+AND(A2="Yes")+AND(A3="Yes"))
/
INT(NOT(A1="N/A")+NOT(A2="N/A")+NOT(A3="N/A"))
*100
for less typing you can leave out the AND and just write (A1="Yes") which returns True. You can not leave out the NOT because we want a NOT(false) = true value to count all non-N/A columns
Currently I have an IDescriptor that pulls Sales from another FILE for Period 1,2,3. I want to be able to pull Costs from Period 1,2,3 and subtract the totals to get a profit.
The Current I-Descriptor Statement is:
TRANS(SAS1,ITEM,4,'X');#1<1,1,1>+#1<1,1,2>+#1<1,1,3>
4 = Sales
3 = Cost
#1<1,1,1> = Period 1
#1<1,1,2> = Period 2
#1<1,1,3> = Period 3
#1<1,1,4> = Period 4
You are looking for EXTRACT
So, try the following the the loc attribute:
TRANS(SAS1,ITEM,4,'X');EXTRACT(#1,1,1,1)+EXTRACT(#1,1,1,2)+EXTRACT(#1,1,1,3)
The next bit of the question isn't entirely clear to me, so let me know if I've made an incorrect assumption.
Costs come from the current file (the one this dictionary file is) from attribute (field) 3. It has the same format as the data for Sales (<1,1,1 to 3>). In this case you would need to use #RECORD.
TRANS(SAS1,ITEM,4,'X');EXTRACT(#1,1,1,1)+EXTRACT(#1,1,1,2)+EXTRACT(#1,1,1,3);EXTRACT(#RECORD,1,1,1)+EXTRACT(#RECORD,1,1,2)+EXTRACT(#RECORD,1,1,3);#2-#3
So, let's break it down:
Read attribute 4 from record ITEM in file SAS1. Return an empty string if the item doesn't exist. Hold this in position 1 (#1):
TRANS(SAS1,ITEM,4,'X');
Extract multi-subvalues 1 to 3 from the value in position 1 then add them together (). Hold this in position 2:
EXTRACT(#1,1,1,1)+EXTRACT(#1,1,1,2)+EXTRACT(#1,1,1,3);
Extract multi-subvalues 1 to 3 from the current record and add them together. Hold this in position 3:
EXTRACT(#RECORD,1,1,1)+EXTRACT(#RECORD,1,1,2)+EXTRACT(#RECORD,1,1,3);
Finally, subtract the value in position 3 (total costs) from the value in position 2 (total sales). As this is the last position, return the result:
#2-#3
The only missing thing in Dan's answer is that you need another TRANS to get your COST field, hence TRANS(SAS1,ITEM,3,'X');
after the first operations on the EXTRACTs.