How do I Use a variable I created as a DB Query?
I THOUGHT I was doing things correctly... obviously not.
Given:
ManufacturingOrderIdSearchTextBox SetText "10008459"
I wanted to change the 10008459 to the result of an SQL Query.(Which may, or may not, be the same)
First, created a variable...
Variables --> Right Click --> New Item
Change Name (Var1) to MyOrderNumber
Change Type (String) to DB Table
Click the elipsis at the right of Default Value field and...
Select Database Query
Select Connection: Microsoft OLE DB Provider for SQL Server <Next>
1. Server Name :TestSQL
2. Use Windows NT Integrated Security
3. Select Database: production
Test connection: Test Connection succeeded (YEA!)
<OK><OK><Next>
Enter Query text:
SELECT TOP 1
mo.ManufacturingOrderId
FROM Production.ShopFloorControl.ManufacturingOrder_base mo
WHERE mo.HasBeenPrinted = 0
AND mo.ManufacturingStatusId < 5
AND mo.DateEntered > '2015-01-01'
AND mo.ManufacturingDueDate < '2049-01-01'
AND mo.isManaged = 1
order by mo.DateEntered desc
Click View Results:
Happy Happy Joy Joy
click Finish
So... now I just have to USE the variable... this is NOT proving to be very do-able...
Tried: click on the set text Value field elipsis to open Operation Parameters
Clicked on the elipsis in the Value column to bring up edit parameter.
Mode:Variable
Value: KeywordTests.OPS_Manufacturing_Order_PORegression_Key.Variables.MyOrderNumber (Had to select from a dropdown)
When Run, I get an Exception: Type MisMatch...
BUT WAIT! (Next up, Solution!)
OK, So I had this problem, and from the messages I have seen, it is not Toooo uncommon, So I decided to post. When I was Allllmost done with all the screenshotting and such, I stumbled across the solution.
The Edit parameter box, once you make your selection from the tree, looks like this:
Yeah, ya need to click on that...
and fiddle with the Down Arrow/elipsis-from-heck until you get the right Value to show
Once done... it works!!!! (For Me, YMMV, etc...etc...etc...)