How to concatenate project SOAPUI variables in a test Request? - soap

I have defined test suite properties as msisdn and imsi. Is there any way that both the variables are substituted for their values. I can get only the last variable to be substituted.
${properties#imsi}${#properties#msisdn}
Only value for msisdn gets replaced

Related

ADF Pipeline Use variable inside another Set Variable

I have two activities inside a for each
Set variable 1 - Value is a string. I want to add this string to the content of Set Variable 2
#item().MessageType (eg :- EVENT, TYPE , STATUS etc. These are the output of a dataflow activity)
Set variable 2 :
#activity('df_dataflow_activity').output.runStatus.output.CacheWaterMarkValue.value[0].EVENT
Here, I want to dynamically change the last part to EVENT,STATUS etc.
#activity('df_dataflow_activity').output.runStatus.output.CacheWaterMarkValue.value[0].{get value of Variable 1)
I tried but getting unable to parse error.
`#activity('df_dataflow_activity').output.runStatus.output.CacheWaterMarkValue.value[0].EVENT`
gives me result of 99999 . The last part EVENT/TYPE/STATUS I want it to be dynamic
Set Variable is used to store the value into a variable. You can use that variable in later activities.
You can include the variable which is used in set variable1 in set variable2.
Set variable1:
Set Variable2:
#concat('sample_',variables('var1'))

Access locally scoped variables from within a string using parse or value (KDB / Q)

The following lines of Q code all throw an error, because when the statement "local" is parsed, the local variable is not in the correct scope.
{local:1; value "local"}[]
{[local]; value "local"}[1]
{local:1; eval parse "local"}[]
{[local]; eval parse "local"}[1]
Is there a way to reach the local variable from inside the parsed string?
Note: This is a simplification of the actual problem I'm grappling with, which is to write a function that executes a query, accepting a list of columns which it should return. I imagine the finished product looking something like this:
getData:{[requiredColumns, condition]
value "select ",(", " sv string[requiredColumns])," from myTable where someCol=condition"
}
The condition parameter in this query is the one that isn’t recognised and I do realise I could append it’s value rather than reference it inside a string, but the real query uses lots of local variables including tables etc, so it’s not as easy as just pulling all the variables out of the string before calling value on it.
I'm new to KDB and Q, so if anyone has a better way to achieve the same effect I'm happy to be schooled on the proper way to achieve this outcome in Q. Would still be interested to know in the variable access thing is possible though.
In the first example, you are right that local is not within the correct scope, as value is looking for the global variable local.
One way to get around this is to use a namespace, which will define the variable globally, but can only be accessed by calling that namespace. In the modified example below I have defined local in the .ns namespace
{.ns.local:1; value ".ns.local"}[]
For the problem you are facing with selecting, if requiredColumns is a symbol list of columns you can just use the take operator # to select them.
getData:{[requiredColumns] requiredColumns#myTable}
For more advanced queries using variables you may have to use functional select form, explained here. This will allow you to include variables in the where and by clause of the select statement
The same example in functional form would be (no by clause, only select and where):
getData:{[requiredColumns;condition] requiredColumns:(), requiredColumns;
?[myTable;enlist (=;`someCol;condition);0b;requiredColumns!requiredColumns]}
The first line ensures that requiredColumns is a list even if the user enters a single column name
value will look for a variable in the global scope that's why you are getting an error. You can directly use local variables like you are doing that in your function.
Your function is mostly correct, just need a slight correction to append condition(I have mentioned that below). However, a better approach would be to use functional select in this case.
Using functional select:
q) t:([]id:`a`b; val:3 4)
q) gd: {?[`t;enlist (=;`val;y);0b;((),x)!(),x]}
q) gd[`id;3] / for single column
Output:
id
-
1
q) gd[`id`val;3] / for multiple columns
In case your condition column is of type symbol, then enlist your condition value like:
q) gd: {?[`t;enlist (=;`id;y);0b;((),x)!(),x]}
q) gd[`id;enlist `a]
You can use parse to get a functional form of qsql queries:
q) parse " select id,val from t where id=`a"
?
`t
,,(=;`id;,`a)
0b
`id`val!`id`val
Using String concat(your function):
q)getData:{[requiredColumns;condition] value "select ",(", " sv string[requiredColumns])," from t where id=", .Q.s1 condition}
q) getData[enlist `id;`a] / for single column
q) getData[`id`val;`a] / for multi columns

how to read and compare a part of output string with a stored variable in seleniumIDE

98619664xxxx1::01070:0001:SKIP:0 X
is my output that I see in browser, from the xpath=//pre[contains(.,'98619664xxxx1::01070:0001:SKIP:0 X')] and I want to extract only 619664xxxx1 from the output string and verify this with a variable I have set in the test suite of the project.
I have tried the storeText of the output to a variable and then with if condition trying to read the text with my variable.
A part of the log:-
assertElementPresent on xpath=//pre[contains(.,'98619664xxxx1::01070:0001:SKIP:0 X')] OK
20.storeText on xpath=//pre[contains(.,'98619664xxxx1::01070:0001:SKIP:0 X')] with value response OK
if on "${response}" == "${Rufnummer1}" Failed:
missing ) in parenthetical

Teamcity not printing built-in parameters using Powershell

I'm trying to print TeamCity parameters using Powershell. The Teamcity parameter is formed at run-time, by assigning it values elsewhere. The problem is that Teamcity only prints the string thus formed and not the value that is stored within the parameter. Please see a sample code where I need to print the build id, here the words "teamcity" and "build.id" are formed during run time. However, upon running Teamcity prints the string %teamcity.build.id%, and not the actual build id.
NOTE:
The type of TeamCity build in parameters that I need to print are agent parameters and not system parameters or environment parameters
$per = "%"
$t = "teamcity"
$b = ".build.id"
$indirect = $per+$t+$b+$per
Write-Output $indirect
PowerShell can't interpret the TeamCity variable at runtime.
The variable is injected into the script prior to it being run, thus the only way to do this would be to reference the variable as a whole.
e.g.
$buildId = "%teamcity.build.id%"
Write-Output $buildId

SQL variables and the IF statement

I am using T-SQL in SQLCMD mode in SSMS to run various subfile from one file, and the principle file (princ.sql) is where I need to declared and set a variable #MyInteger and run a subfile:
DECLARE #MyInteger INT
SET #MyInteger = 20
:setvar path "your absolute file path here"
:r $(path)\"query.sql"
:r $(path)\"uses Myingteger too.sql"
This works fine; as a minimal example, consider query.sql and 'uses MyInteger too.sql' to have the same one line
SELECT #MyInteger
and i do get back two instances of 20.
My trouble is that I would like to be able to run query.sql on its own using a locally defined variable #SubMyInteger.
My ideal situation for query.sql is
IF #MyInteger is declared
SET #SubMyInteger = #MyInteger
ELSE
SET #SubMyInteger = 90
SELECT #SubMyInteger
Then when I run query.sql, #MyInteger would not have been declared, so #SubMyInteger would be assigned 90, and 90 would be returned. I would also get back two 20s as before if i ran princ.sql
For the IF statement, I have so far tried two things:
IF OBJECT_ID('#MyInteger') IS NOT NULL
and
IF #MyInteger IS NOT NULL
I get the error
Must declare scalar variable "#MyInteger".
If I try declaring #MyInteger and then run princ.sql, I get the error
The variable '#MyInteger' has already been declared.
even if the declare statement is conditioned with an IF.
Is there a way to achieve what I want here?
Thanks