Mule variable in MEL as String - mule

i have an expression bellow to read a file from resources :
#[Thread.currentThread().getContextClassLoader().getResourceAsStream('abc.txt')]
it worked fine, but i want to use a variable like this one:
#[Thread.currentThread().getContextClassLoader().getResourceAsStream(flowVars['fileName'])]
it does not work,
how can i make it work like the first one MEL ?
how can i read a file in absolute path "D://input/abc.txt" using MEL ?
Thanks for helps.
resolved
use flowVars.filename instead of flowVars['fileName'] it worked, but i can't get it, i use logger with this MEL #[flowVars['filename']] and it work too but in the second MEL it failed.

1) You are using a different case with the two different approaches. Variable names are case sensitive.
2) Just use a FileInputStream:
#[new FileInputStream("path")]
Or even better maybe to use the File transport/Mule Requester Module.

Try this, Use variable name instead of using keyword "flowVars"
#[Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName)]

Related

JMeter - get value from href

I am load testing an application that has a link that looks like this:
https://example.com/myapp/table?qid=1434e99d-5b7c-4e74-b64e-c24e9564514d&rsid=5c94ddc7-e2e4-4e69-8547-49572486f4d1
I need to get the dynamic value of the rsid so I can use it later in my script.
So far I have tried using the regex extractor and I am probably doing it wrong.
I have tried things like:
name = myvar
regular expression = rsid=(.*?) # didnt work
regular expression = <a href=".*?rsid=(.*?)"> # didnt work
Template = $1$
I have one extractor set up to get the csrf value and that one works as expected but that is also because the csrf value is in the page source.
The above link is NOT in the page source as far as I can see but it DOES show up when I inspect the link. I dont know if that is obfuscation or something else?
How can I extract the value of the rsid? Is the regular expression extractor the right one to use for this?
Should I be using something else?
Is it just a formula issue?
Thanks in advance.
Try something like:
rsid=[0-9A-Fa-f\-]{36}
the above regular expression should match a GUID-like structure and your rsid seems to be an instance of it.
Demo:
Also be aware of the Boundary Extractor, it's sufficient to specify "left" and "right" boundaries and it will extract everything in-between. In general coming up with "boundaries" is much easier than creating a regular expression, it's more readable and JMeter processes the Boundary Extractors much faster. More information: The Boundary Extractor vs. the Regular Expression Extractor in JMeter

Karate pathMatches exclusion

I would like to have possibility in Karate to match all paths except /example/path, to have something like this:
pathMatches ('!/example/path')
Is there such possibility?
You can use the requestUri variable which will be always set automatically. The nice thing about the design is you can use "normal" Java Script and achieve any combination you want, pathMatches() is just pre-defined for convenience.
So this should get you what you want, try it !
Scenario: !requestUri.startsWith('/example/path')
EDIT: silly me, I just realized that you have a much better option, again "because JavaScript". This will work !
Scenario: !pathMatches('/example/path')

Qlikview -- Using If with a variable in expression

I am trying to use an if statement with a variable in my expression and I get no results. The variable works when I use the variable on it's own but when used with the if I get no results.
I have tried:
if(OrderQtr='Apr-Jun 2018',$(vAvgOrderCost),0)
if(OrderQtr='Apr-Jun 2018',sum($(vAvgOrderCost)),0)
sum($(vAvgOrderCost)if(OrderQtr='Apr-Jun 2018',0))
Nothing seems to work. Thanks
Variables in QlikView are used as a text replace feature, so be carefull. If your variable hold a value like 1,345 an expression like "if(OrderQtr='Apr-Jun 2018',$(vAvgOrderCost),0)" will be translated into "if(OrderQtr='Apr-Jun 2018',1,345,0)" which by itself will be a syntax error.
Something like :
Num(if(OrderQtr='Apr-Jun 2018','$(vAvgOrderCost)','0'))
would be a safe way to go.
the if() syntax should work like this if(test,true,false)
So looking at your examples I suspect this is what you are trying to do
sum(if(OrderQtr='Apr-Jun 2018',$(vAvgOrderCost),0))

workfusion webelement has two variable ad doesnt take anything

Workfusion I am trying to make two variables through web-element. When running individually its great but when running separately it has problems.
Please see the picture for the same. This doesn't get executed.
If your XPath has any variable then try the giving a value like following:
//*[#id="mv-tiles"]/a[${i}]
and you can keep changing value of i through loop. A variable inside another will throw error in Workfusion RPA Express.
The ${} evaluates the whole it's body.
Does the following, without nested ${} execute OK?
${webrange[countertemp]}

How to combine Wix variables

I can use "!(bind.property.ProductVersion)" to set for example the UpgradeVersion\#Minimum attribute. Works fine.
But now I want to set that attribute to something like:
"!(bind.property.ProductVersion.Major).!(bind.property.ProductVersion.Minor).0.0"
But that does not work.
I get this error: The UpgradeVersion/#Maximum attribute's value, '!(bind.property.ProductVersion.Major).!(bind.property.ProductVersion.Minor).0.0', is not a valid version. Legal version values should look like 'x.x.x.x' where x is an integer from 0 to 65534.
Any ideas how I can get this to work?
Regards, Jaap
Unfortunately, it appears the version attribute is only allowed to have a single binder variable to replace the whole string. It doesn't support the scenario you describe. However, it seems like it should. You could file a bug at http://wixtoolset.org/bugs