Logic Apps: Using the "compose" action with an IF statement - azure

I am using a compose action in a logic app in which I need to use a logical function that if xx condition passes then it can take the output from one compose action say compose1 and if failed then it can use from compose2
I tried to use the "if" logical function but it keeps saying that the expression is wrong.
Ex what I have used ...
if(contains(outputs('Create_duplicateKey'),'SendVehicleOrder'),'outputs('Compose_Priority')','outputs('Compose_Category')')
I have also tried to directly use the outputs of compose1 and compose2 but it is still failing ...
if(contains(outputs('Create_duplicateKey'),'SendVehicleOrder'),'Id: #{items('Loop_through_all_alerts')?['ID']}','orderType: #{items('Loop_through_all_alerts')?['OrderType']}')
Is there anyway I can use these outputs in an expression

After reproducing from my end, like #Skin mentioned removing quotes will make it work.
if(contains(outputs('Create_duplicateKey'),'SendVehicleOrder'),outputs('Compose_Priority'),outputs('Compose_Category'))
Alternatively, you can use condition action to achieve your requirement.

Related

Property assignment expected. This expression is not callable. Type {} has no call signatures. (how to solve this?)

I wanted to update a badge count in a chat room using cloud function trigger which is a nested map.
I'm updating badges in the frontend without any issue but I want the create a cloud function for this to reduce frontend workloads.
but when I tried to pass a dynamic variable as field/key, the compiler is not happy and it's giving me an error.
the expected output should be like this
Backtick doesn't work so I tried to change the backtick to double quote to be able to compile, but this was the output which is not what i want.
anyone knows how to make this work? please help.
its syntax issue, missing [ & ].
it should be { [`badgeCount.${receveid}`]: fire.....

ADF adding equals condition to existing if condition

I have an if condition in an ADF activity like below:
#if(
contains(activity('LookupWmkLastUpdateConfig').output,'firstRow')
,greater(
activity('LookupLastUpdateSrc').output.lastModified
,activity('LookupWmkLastUpdateConfig').output.firstRow.NewValueWatermark)
),
false)
The if condition looks as the last update date in src vs my database. Want I want to include is an additional block of code that evaluates an outside parameter called TypeLoad.
The current set-up only allows for full loads, I want to be able to include delta loads.
Does anyone know how to include such a piece of logic to the existing if code?
equals(pipeline().parameters.FwkItem['TypeLoad'],1)
The above condition would for example evaluate the full or delta load.
All help is very welcome.
Thanks!
I tried to repro this in my environment. I gave the same expression
#if(
contains(activity('LookupWmkLastUpdateConfig').output,'firstRow')
,greater(
activity('LookupLastUpdateSrc').output.lastModified
,activity('LookupWmkLastUpdateConfig').output.firstRow.NewValueWatermark)
),
false)
Same error function 'if' does not accept 2 arguments is occurred.
When the expression is looked into the reason for error, there were two closing parentheses near ,activity('LookupWmkLastUpdateConfig').output.firstRow.NewValueWatermark) ) .
Same is highlighted in the above image.
one parenthesis is removed and gave the expression as in below image.
#and(equals(pipeline().parameters.fwkitem,1),if(contains(activity('LookupWmkLastUpdateConfig').output,'firstRow'),greater(
activity('LookupLastUpdateSrc').output.lastModified
,activity('LookupWmkLastUpdateConfig').output.firstRow.NewValueWatermark)
,false))
Expression doesn't produce any error now.

JMeter functions and variables

I'm new to JMeter so this question may sound absolutely dumb...
I have a loop in which a variable (let's say it is called "raw") is being changed and written to file every iteration. The variable contains HTML encoded text so it has to be converted into plain text. I found out this can be done using __unescapeHtml function. When I tried using it worked but I ended up always receiving the same text as on the first iteration. Then I learned that I have to use vars.get instead of ${} to access a variable. So I changed ${__unescapeHtml("${raw}")} to ${__unescapeHtml(vars.get("raw")} which kind of helped: vars.get is getting the new value of raw each iteration but __unescapeHtml didn't work at all now - it just returns the encoded text from raw. I didn't succeded finding anything about this exact problem so I'm kind of stuck.
Ended up using
import org.apache.commons.lang3.StringEscapeUtils
...
StringEscapeUtils.unescapeHtml4(vars.get("raw"))
Don't know if it is a good way to do this but at least it works.
I assume, that you are using the expression ${...} inside a JSR-223 sampler or similar context. The user manual for JSR-223 Sampler states, that those scripts can be cached by JMeter. That is why you only get the values from the first time the context gets created.
The same is true for simple variable evaluations as ${varname}, as for function calls like ${__unescapeHtml(...)}.
The solution here is:
don't use ${...} inside of JSR-223 contexts, that might be cached.
you can however pass those expressions (${...}) into the context by using them as parameters through the input labeled Parameters on the JSR-223 Sampler – again assuming, that you are using it.
you can use the features, that your chosen JSR-223 context gives you, as you have done, by using the StringEscapeUtils#unescapeHtml4

How to pass JSON into an Azure Function with embedded dynamic content in Azure Data Factory V2

In ADFv2 I'm looking up a date and passing it to an Azure Function. I can pass just the data like so:
#activity('GetLastDateProcessed').output.firstRow.LastDateProcessed
However if I embed this into a JSON string like this:
{"lastProcessDate":"#activity('GetLastDateProcessed').output.firstRow.LastDateProcessed"}
I get this {"lastProcessDate":"#activity('GetLastDateProcessed').output.firstRow.LastDateProcessed"} instead of {"lastProcessDate":"2019-11-13"} as input into function.
Last I've tried to use a parameter with no success also.
#concat('{"lastProcessDate":"', string(pipeline().parameters.lastProcessDate), '"}')
The problem here is the parameter was not set. I set the parameter like this:
#activity('GetLastDateProcessed').output.firstRow.LastDateProcessed
However this is a default value and is never dynamically updated. If I can update this string then the #concat method will work, but haven't been able to figure out how to dynamically update a parameter for the pipeline.
Another option could be a pipeline variable, but I don't know how to reference the variable.
How do I concat strings together with dynamic content?
I think what you are missing is that when you use the at-sign '#' in the json string you should follow it with a curly bracket '{'
In your example it will look something like this:
{"lastProcessDate":"#{activity('GetLastDateProcessed').output.firstRow.LastDateProcessed}"}
here is the source (found it in the comments):
https://azure.microsoft.com/en-us/blog/azure-functions-now-supported-as-a-step-in-azure-data-factory-pipelines/#:~:text=Azure%20Data%20Factory%20(ADF)%20is,in%20your%20data%20factory%20pipelines.
I was able to get this to work by creating a second pipeline. This is not optimal, but works for people running into this same issue. Hopefully someone finds a better solution than this!
From the first pipeline I set the second pipelines parameter with this:
#activity('GetLastDateProcessed').output.firstRow.LastDateProcessed
I named the parameter in the second pipeline lastProcessDate so then this worked:
#concat('{"lastProcessDate":"', string(pipeline().parameters.lastProcessDate), '"}')
This is not straight forward and can't be how Microsoft is expecting us to solve this!
I was able to achieve this with command.
{
"storedprocedure":"storedProcName",
"params":"#{variables('currentDt')}"
}

Is there an equivalent OR logic based from a Variable value in Origen?

I am working on Verigy 93K test program and I have a logic that I would like to know if there's an equivalent code in Origen.
I am working on Verigy 93K test program and I have this logic (IF condition) that I need to insert in my flow.
Basically, I have a variable called 'INSERTION' and this will have different values like 'GCORR', 'VCORR' and others.
I would like to know if there's an equivalent code like this in Origen.
I attached a snapshot, hope that it can help clarify my question more.
In this logic, I would like to check the INSERTION value and if the value is not equal to GCORR or VCORR, the logic should pass, else, fail.
Here is the screenshot:
This pull-request adds an official API for this.
This example would be implemented as:
whenever_any ne(:INSERTION, 'GCORR'), ne(:INSERTION, 'VCORR') do
# Your tests in here
end
That would produce something logically equivalent and which can be re-targeted to other platforms.
If you don't care about that and want to produce exactly as you have it in the above example, then this should work too (where the OR is hard-coded for V93K syntax):
whenever ne(:INSERTION, 'GCORR|VCORR') do
# Your tests in here
end
Here is the preliminary documentation of this feature from the above PR - https://github.com/Origen-SDK/origen_testers/blob/66345c9422d9fa6b2577af20110259e45c2bdd26/templates/origen_guides/program/flowapi.md.erb#L71
I couldn't find api support on flow control or variable values beyond "if/unless_enable" support which can help check for 1 or zero. One way is to use render.
render 'if #INSERTION != "GCORR|VCORR" then'
render '{'
# your code for non-GCORR_VCORR flow
render "} \n else \n { \n } "

Resources