I have tried the below using custom actions:
type: QUERY
connectionURL:jdbc:microsoft:sqlserver://server_name:1433
connection.user: my_user_name
connection.password: my_password
sqlStatement: SELECT count(*) FROM [employee].[dbo].[tblProductSales]
variableName: Count
Command:
I am unable to get the result of the query either in Details/Variables Tab of Check Virtual User Window.And also I am getting response code for this Custom Action as 0.
The output will be saved as "Count_<column name>_<row number>" in your case, Count_COUNT_1 should have the output.
You can use a Javascript to read the output and save it in a variable and use it.
Thanks for the reply.
Can you provide the sample code to read the output using javascript? And also I didn't understand why we need to specify Column name(Count_<column name>_<row number>),as here I am trying to get the total count of the records
If you execute Select * from <Tablename> then you may get more than 1 column and 1 row and to get a specific cell you can specify the column name and row number to get values. Column information would be "Column Name" and row information would be the "row number". In your case, the column name would be "COUNT" and there will be only 1 row so you need to specify that specific value.
Sample code:
var myVar = context.variableManager.getValue("Count_COUNT_1");
context.variableManager.setValue("<Neoload_VariableName>",myVar);
I am not able to get the count by using the sample code.
Share the output from the SQL Custom Action step. Are you able to see the output (count) there?
No..I am not able to find the ouput.
Find the attachments
The variableName says 'Total' inside the Custom Action. Change the javascript to Total_COUNT_1. Please note JavaScript is case sensitive.
I have changed it.But still facing the same issue
Can you try to change the query to select * from table to see if you see any output in the custom action?
In the screenshot, I see it being blank.
I have tried using "select * from table" query with javascript variable as Total_<Column Name>_1.But still unable to read the value.
If at all you have tried it.Can you share the script?
Please attach screenshots of the custom action and the output of the custom action.
When you execute the following query in SQL server you are able to get output?
SELECT * FROM [employee].[dbo].[tblProductSales]
I am unable to get the output.Please find the attachments....
Havn't received any reply!!!
Shruthi answered
Shruthi answered
Shruthi answered
Rajagopal answered
Shruthi answered
Rajagopal answered
Shruthi answered
Rajagopal answered
Shruthi answered
Shruthi answered
Rajagopal answered
Shruthi answered
Rajagopal answered
Shruthi answered
Rajagopal was made best respondent
Rajagopal answered
Shruthi posted a new question