Logic Apps : Use Dynamic content within the Logical functions - azure

I am trying to add a condition in Logic apps using one of the field . I have a field named score .
I want to add a condition and insert to the SQL database column named "Result".
The score returns the values from 1 to 10. I just want to check
if the value lies between 1-5 means then "Negative" if the value lies
between 5-10 means "Positive"
This is what i have done, i have used the logical functions named "if" and wrote the condition as,
if(parameters("Score")>5,"Positive","Negative") //just an example to check
But it says "The expression is invalid" , how should i correct this?

Try the below. It works for me
if(greater(parameters('score'),5) ,'Positive','Negative')

Related

Multiple IF statements in Excel not working

I would like to set a multiple IF statement for my formula.
The reason behind it is, that I need to switch off the values (mark them as N/A and NA) which are equal to the other certain values as follows:
LP372/24/60+1=($NO372-720)/24/60+1 => mark them as N/A - the values, which don't happen during the midnight
and
LP372/24/60+1=$NO372/24/60+1 => mark them as NA - the values, that don't happen during the midday
The problem is, that I can't keep them under one IF statement, because I need the division.
So far I used only one IF statement (the nested one), which looks as follows:
=IF(OR((LP372/24/60+1)=(($NO372-720)/24/60+1), OR((LP372/24/60+1)=($NO372/24/60+1))),"N/A",LP372/24/60+1).
The value of NO372 corresponds to the rough time of the local midday. Substracting the 720 we are getting the rough midday for this location, knowing that the single day counts 24 hours x 60mins = 1440mins.
The formula above gives a nice result, but without the division between midday and midnight, which I am talking about.
Following my older query about the similar issue:
Double nested IF statement formula in Excel
I tried to solve it like this:
=IF(COUNTA(E1116:E1481),IF(OR((LP372/24/60+1)=(($NO372-720)/24/60+1),OR((LP372/24/60+1)=($NO372/24/60+1))),"N/A",LP372/24/60+1),"NA")
where the range E1116:E1481 corresponds to the whole year period (1.01 - 31.12).
Unfortunately I got nothing, similarity to this formula:
=IF(COUNTA(E1116:BC1116),IF(OR((LP372/24/60+1)=(($NO372-720)/24/60+1),OR((LP372/24/60+1)=($NO372/24/60+1))),"N/A",LQ510/24/60+1),"NA"),
where the E:1116:BC1116 range correspond to the all columns - circumstances as occur on January 1.
This formula was still not correct.
I found something on the web about the multiple IF statements:
which led me to the following formula
=IF((LP372/24/60+1)=(($NO372-720)/24/60+1);"N/A";IF((LP372/24/60+1)=($NO372/24/60+1);"NA")LP372/24/60+1)
Unfortunately again not correct.
The last attempt was an answer provided here:
Multiple IF statements in Excel
on which basis I built up another formula
=IF((LP372/24/60+1)=(($NO372-720)/24/60+1),"N/A",LP372/24/60+1,IF((LP372/24/60+1)=($NO372/24/60+1),"NA"))
this time Excel said, that I've entered too many arguments.
Is there a way to set up multiple IF statements?
I need to:
make the values equal to midnight as N/A,
make the values equal to midday as NA
keep the other values as they stand
This question was answered in the comments, but I thought I would add an answer with an example of how to nest IF statements for anyone that found this question because they are having issues with nesting IF statements.
When you add an IF statement to a formula in excel, you have to keep in mind that IF statements have 3 parts separated with commas:
The first value is the condition you are going to check
The second value is the value you want returned if that condition is true
The third value is the value you want returned if that condition is false
So here's an example that illustrates that:
=IF(condition to check, value if condition is true, value if condition is false)
Here is an example IF statement:
=IF(A1="Hello","World","something else")
If you are getting FALSE returned then your IF statement probably looks like this:
=IF(A1="Hello","World")
Notice that there are only 2 values inside this IF statement: the condition you are checking (A1="Hello") and what you want displayed if that is true ("World"). FALSE would be displayed if the value in A1 is something other than Hello because you haven't included the third value in the IF that defines what you want displayed if A1 is not Hello (this value is listed as something else in the example above)
It's best to try and avoid nesting IF statements if you can because they can be hard to keep track of. I would suggest using AND() or OR() instead if you can. They are very similar to each other, you list multiple conditions within the parens separated by commas that you will be checking against, and both evaluate to either True or False. The only difference is that for AND() every condition within the parens needs to be true for it to evaluate to True where OR() only one of the conditions listed in the parens needs to be true for it to return True.
So, for example, if you wanted to display World if A1 is Hello or Hi and you were to use nested IF statements it would look like this:
=IF(A1="Hello","World",IF(A1="Hi","World","something else"))
which in my opinion is really ugly. however, if you used OR() instead of nesting IF statements it would look like this:
=IF(OR(A1="Hello",A1="Hi"),"World","something else")
AND() works the same way, but instead of just needing one condition within the parens to be true to return True as OR() does, with AND() all conditions inside of the AND() need to be true to display your value instead of just one. here's an example AND():
=IF(AND(A1="Hello",B1=""),"World","something else")
in this case "World" would be displayed only if A1 is Hello AND B1 is empty
for both AND() and OR() you can have more than just 2 values inside if you need to check for more than 2 conditions, you just need to separate them each with commas, like this:
AND(condition1, condition2, condition3, ....)
OR(condition1, condition2, condition3, .....)
but, if you have to use nested IF statements, the easiest way I've found is to type IF( , , ) first thing to make sure you are allowing for all 3 values that need to be inside of the IF and you have the right amount of values inside the IF. If you are getting the message You've entered too many arguments for this function it is because you have entered more than 3 values inside your IF, like this:
=IF(A1="Hello","World","something else","this value is causing the issue")
so, to properly nest an IF in your formula, type IF( , , ) first off where you want the IF statement to be in your formula and then just fill in the blanks, then you avoid entering too few values which results in FALSE being displayed if your condition is not true or You've entered too many arguments for this function because you entered more than 3 values in your IF
Hope this helps to understand IF statements and how to nest them properly.

Trouble using concat function in Power Automate

Trying to increment a Unique ID field in my SharePoint list every time my flow runs. Ex: If the Unique ID field in the last row before the flow runs again is "M10389". Then after the flow runs, a new item will be created underneath it and its Unique ID will be "M10390".
The only piece of the flow that doesn't work is the Unique ID part. Here are the pieces of code within the Unique ID field of the create item action block that won't work, but should.
I've tried:
concat(string(M),add(10386,triggerBody()?['resourceData']?['responseId']))
and
concat(M,add(10386,triggerBody()?['resourceData']?['responseId']))
P.S. The "triggerBody()?['resourceData']?['responseId']" is the number of submissions from the form that triggers this flow, and is how I am incrumenting the Unique ID field by one.
Neither work and I think it has something to do with the concat() function, because concat(m,n) doesnt work, neither does concat(string(M),string(2)), or even concat(string(m),string(n)). In fact, the only time concat works is when I'm using 2 numbers like concat(52,7).
The error message simply reads:
"us.flow.microsoft.com says
The expression is invalid."
How do I achieve what I'm after within power automate?
Picture of what this looks like:
A bit similar to Muhammad's answer. Try using a variable, and set the value of the variable to "triggerBody()?['resourceData']?['responseId']".
Then increment by 1 or any arbitrary number and use as needed.
Well another approach to achieve the same could be two create two variables, one to increment unique id number part and second one is to compose the unique id. you can set value of uniqueIdNumbervariable using the Add function like you are already doing i.e.
add(10386,triggerBody()?['resourceData']?['responseId']))
Then you can set the value of second variable uniqueID by using another set variable action i.e.
M uniqueIdNumber
(you need to select 'uniqueIdNumber'variable from dynamic content, in set variable value action for uniqueID variable. )
Then you can use uniqueID variable in Create Item action.

automatic rota system based on special conditions

I am trying to create system for assigning tasks to a team using existing sequence. I have four separate columns:
Column A – Indicates the given sequence of operators
Column B – Indicates number of current tasks per operator (imported from another file by vlookup)
Column C – Indicates the name of the operator that was assigned to the last task (imported from another file by vlookup)
Column D – Indicates whether any of the operators are currently on holiday (check/uncheck check box (TRUE/FALSE logic)
I would like to automate the system so that the next operator that is due to receive tasks is displayed, however the operator must not have more than 4 tasks already assigned to him/her and must be present (not on holiday).
The selection process must repeat taking into consolidation the given sequence until the name is selected, hence if the last name in the sequence is not the exact match the system must start with the first name in the sequence.
Could someone be able to figure this out please as I am completely stock.
Currently, I have the following, column with the following =IF(B2<=4,A2,"N/A") and another column with the following =IF(E2=FALSE,F2,"N/A"). And one more column with =INDEX(SQESequence,MATCH(C2,SQESequence,0)+1,1), however that is not fully automated.
I think that I understand your problem / question and have come up with a solution. A more elegant formula solution may exist, will play with it more if I have time.
{=IFERROR(INDEX(INDIRECT("A"&MATCH(C2,A2:A5)+1&":A5"),MATCH(1,(INDIRECT("A"&MATCH(C2,A2:A5)+1&":A5")<>$C$2)*(INDIRECT("B"&MATCH(C2,A2:A5)+1&":B5")<4)*(INDIRECT("D"&MATCH(C2,A2:A5)+1&":D5")=FALSE),0)),INDEX($A$2:$A$5,MATCH(1,($A$2:$A$5<>$C$2)*($B$2:$B$5<4)*($D$2:$D$5=FALSE),0)))}
Enter CTRL SHIFT ENTER to set as an array formula, each function then returns an array of values rather than just a single value. You know you have set as an array formula when you see the { } 's
They say that a picture is worth 1000 words....so here are three!

How to apply a filter in a REST Snap and hard code the value?

Suppose there is some data which I want to pass through the rest snap and in the query parameter I have given filter and in query parameter value I want to pass a hardcoded value. For example, "name .eq ", then what?
How can I give a hardcoded value in this filter option?
You can pass hard-coded values as it is. Refer to the following screenshot.
Just don't click on the expression button (the button with = on it) and you should be good.

NetSuite saved search filter records with min quantity

How do I apply following requirement in Saved Search criteria?
Filter all inventory items
Where min( {memberitem.quantityavailable} / {memberquantity} ) <> custitem_quantity
Note: custitem_quantity is a custom numeric field.
Note2: NetSuite is throwing error when I use min function in filters.
There is more than one issue here.
You have to be careful with custom numerics in Netsuite.
When your inner condition evaluates, it does not have the same type because it is fractional. At some point it has to be rounded and / or truncated internally. The other side of the expression would need to call a floor or ceiling function to remove everthing past the decimal.
Also, the min function evaluates after the <> conditional, which will be dependent upon whether your custom numeric is type compatible to begin with.
In the expression you provided us, it would have to be an exact match (and an exact type), and that is before you consider whether MIN gets to be evaluated.
Look at how the datatypes are cast and what columns you are processing because memberitem.quantityavailable may need a secondary index depending upon your dependencies and where the formula is being called. If this formula is being used over multiple products, it may not be logically consistent.
When I have similar items in inventory that I want to generate stats for I try to process it separately, even if I have to make a second pass.
What are you trying to isolate exactly - - I cannot think of a quantity-related situation where there would be a need to use division in this way - - please refer to the formula Mike Robbins listed above for a properly structured evaluation and see if it achieves the desired result.
If you post the rest of your code, I will help you resolve this.
The entire expression is not valid and will not evaluate due to the conditional shown, the MIN, nor the division. Index the count on the memberquantity if you are looking to sum over values. Otherwise, CountIF will work for quantities. MIN will only finds the lowest value in a given column, so SumIF appears to be what you are after. You can create a second expression which bounds the values you are searching for as a preliminary step.
I am new here, so please elaborate on what you are trying to accomplish so I can earn the bounty.
You may want to take into account null values as well to avoid errors or inconsistent data.
If you're using formula numeric, try this:
Formula(Numeric):
case when min((NVL({memberitem.quantityavailable},0) / NVL({memberquantity},0)) - (NVL{custitem_quantity},0)) then 1 else 0 end
'IS EQUAL TO' 1
I believe you can use the Formula Text or Formula Numeric Search Filter for that.

Resources