Results 1 to 8 of 8

Thread: Type mismatch

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    8

    Type mismatch

    I am getting an error of type mismatch error. Here is the code:-
    If OracleFormWindow("Vendor Items").OracleTable("Vendor Items Table").GetFieldValue(x, "SKU #") = DbGetString(dbCon, "select distinct sku_no from vendor_item where sku_no = " & arrSkus(0, x-1))Then


    Can enyone help me with this
    Thanks

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Type mismatch

    Without having more info all I can tell you is that type mismatch means that you are trying to put one type of data into something that is meant to have a different type of data such as an alpha value into a numeric field or var or a non date into a date field or var.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    8

    Re: Type mismatch

    I can send you the whole code. I tried checking all the variable but could not spot it. this code is not written by me so making difficult to figure out.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    8

    Re: Type mismatch

    Test Script Setup
    LoadFunctionLibrary Left(Environment.Value("TestDir"), InStrRev(Environment.Value("TestDir"), "\projects")) & "projects\global\functions\lib\Initialize.qfl"
    Initialize_SetupTest

    ' Initialize Variables
    dbCon = Environment.Value("dbOracle")
    importPath = Environment.Value("importPath")
    skuDesc = Environment.Value("skuDesc")
    employeeId = Environment.Value("employeeId")
    password = Environment.Value("password")
    rndVnd = Toolbox_RandStr(7)
    numSkus = 5
    skuPrice = Array(1, 2, 3, 4, 5)
    skuCost = Array(0.5, 0.75, 1, 1.5, 1.75)

    ' Function creates Vendor ID
    vendor_id = QIVendor_Create(dbCon, importPath, "AutoVendor.txt", rndVnd, rndVnd, "1234 FAKE ST", "SALT LAKE CITY", "UT", 84101, "USA", 8015554948)

    'Authenticate: Authorizing Employee, Password, Site Number - OPTIONAL
    General_Login employeeId, password, 1

    ' Ensure we are logged into the correct site
    General_SetSiteNo 1

    '' Verify that the SKU's with the given description do not already exist. If they do, fail the test and exit.
    ' If Not IsEmpty(DbGetArray(dbCon, "select sku_no from invtory where description like '" & skuDesc & "%' order by sku_no"))Then
    ' Reporter.ReportEvent micFail, "SKUs already exist", "The SKUs with the name like '" & skuDesc & "' were already found in the database, so no new SKUs will be created."
    ' Initialize_CleanupTest
    ' ExitTest
    ' End If

    ' Open Inventory Items Form
    General_FuncNavOpen "File Maintenance>Inventory Items>Inventory Items Form"

    ' Ensure that we are in SKU # mode
    If Not JavaWindow("RETAIL.net").JavaList("Item Selection").GetROProperty("value") = "SKU #" Then JavaWindow("RETAIL.net").JavaList("Item Selection").Select "SKU #"

    'Populate Inventory Items Form to create 5 SKUs
    For x =1 to numSkus
    OracleFormWindow("Inventory Items").OracleTextField("Description").Enter skuDesc & " " & x
    OracleFormWindow("Inventory Items").OracleTextField("Dept #").Enter Environment.Value("skuDept")
    OracleFormWindow("Inventory Items").OracleTextField("Class #").Enter Environment.Value("skuClass")
    OracleFormWindow("Inventory Items").OracleTextField("Line #").Enter Environment.Value ("skuLine")
    OracleFormWindow("Inventory Items").OracleTextField("MFG Code").Enter skuDesc & x
    OracleFormWindow("Inventory Items").OracleTextField("Receipt").Click
    OracleFormWindow("Inventory Items").OracleButton("Inventory by Site").Click
    OracleFormWindow("Inventory by Site").OracleTextField("Pricing|Qty|Level 1").Enter "1"
    OracleFormWindow("Inventory by Site").OracleTextField("Pricing|Price|Level 1").Enter skuPrice(x - 1)
    OracleFormWindow("Inventory by Site").OracleCheckbox("Discount Allowed").Select
    OracleFormWindow("Inventory by Site").OracleCheckbox("Allow Price Change").Select
    OracleFormWindow("Inventory by Site").OracleCheckbox("Automatically Replenish").Clear
    OracleFormWindow("Inventory by Site").OracleButton("OK").Click
    If OracleNotification("Confirmation").Exist(3) Then
    OracleNotification("Confirmation").OracleButton("Exclude").Click
    End If
    OracleFormWindow("Vendor Info").OracleTable("Vendor").EnterField 1, "Vendor ID", vendor_id
    OracleFormWindow("Vendor Info").OracleTable("Vendor").EnterField 1, " Vendor Pack Cost", CStr(skuCost(x - 1))
    OracleFormWindow("Vendor Info").OracleButton("OK").Click
    OracleFormWindow("Inventory Items").SelectMenu "File->Save"
    JavaWindow("RETAIL.net").JavaButton("Cancel Current Action").Click
    Next

    ' Close the Inventory Items Form
    OracleFormWindow("Inventory Items").CloseForm

    ' Browse Home
    OracleFormWindow("Function Navigator").OracleTextField("Home").Click

    'Check that the skus to be created now exist
    arrSkus = DbGetArray(dbCon, "select sku_no, description from invtory where description like '" & skuDesc & "%' order by sku_no")
    If Not IsEmpty(arrSkus) Then
    isPass = true
    For i = 0 to UBound(arrSkus,2)
    If Not IsNull(UBound(arrSkus,2)) then
    strResults = strResults & "<tr><td>" & arrSkus(0,i) & "</td><td>" & arrSkus(1,i) & "</td></tr>"
    Else
    strResults = strResults & "<tr><td>" & arrSkus(0,i) & "</td><td>" & arrSkus(1,i) & "</td></tr>"
    isPass = false
    End If
    Next
    If isPass Then
    Call Checkpoint_CustomReporter("Pass", "Verify SKU(s) Exist", "<table class=""tbFormat""><tbody><tr><th>SKU #</th><th>Description</th></tr>" & strResults & "</tbody></table>")
    Else
    Call Checkpoint_CustomReporter("Fail", "Verify SKU(s) Exist","<table class=""tbFormat""><tbody><tr><th>SKU #</th><th>Description</th></tr>" & strResults & "</tbody></table>")
    End If
    Else
    Reporter.ReportEvent micFail, "Verify SKU(s) Exist", "No SKU(s) were found."
    End If

    'Log Out Retail.Net Application
    JavaWindow("RETAIL.net").JavaMenu("File").JavaMenu("Logout").Select

    'Authenticate: Authorizing Employee, Password, Site Number
    General_Login employeeId, password, 1

    ' Open Vendor Form
    General_FuncNavOpen "File Maintenance, Vendor, VendorForm"

    'Populate Vendor and Vendor Items Form
    OracleFormWindow("Vendor").OracleTextField("Vendor ID").Enter vendor_id
    OracleFormWindow("Vendor").OracleTextField("Name").Click
    OracleFormWindow("Vendor").OracleButton("Vendor Items").Click

    'Verify that the Item is in the list and its cost data is correct.
    For x = 1 to numSkus
    If OracleFormWindow("Vendor Items").OracleTable("Vendor Items Table").GetFieldValue(x, "SKU#") = DbGetString(dbCon, "select distinct sku_no from vendor_item where sku_no = " & arrSkus(0, x-1))Then
    Reporter.ReportEvent micPass, "Verify Vendor Item in DB", "The SKU# " & arrSkus(0,x-1) & " was found in the VENDOR_ITEM table."
    Else
    Reporter.ReportEvent micFail, "Verify Vendor Item in DB" , "The SKU# " & arrSkus(0,x-1) & " was not found in the VENDOR_ITEM table."
    End If
    displayedCost = FormatCurrency(OracleFormWindow("Vendor Items").OracleTable("Vendor Items Table").GetFieldValue(x," Vendor Pack Cost"))
    If displayedCost = FormatCurrency(skuCost(x - 1)) then
    Reporter.ReportEvent micPass ,"Verify Vendor Pack Cost on Vendor Form", "Verified that the displayed Vendor Pack Cost for SKU# " & arrSkus(0, x-1) & " was " & FormatCurrency(skuCost(x - 1)) & "."
    Else
    Reporter.ReportEvent micFail, "Verify Vendor Pack Cost on Vendor Form" , "The displayed Vendor Pack Cost for SKU# " & arrSkus(0, x-1) &" was $" & displayedCost & ". Expected $" & FormatCurrency(skuCost(x - 1)) & "."
    End if
    Next
    exittest
    'Close Vendor iTems Form
    OracleFormWindow("Vendor Items").OracleButton("OK").Click

    'Close Vendor Form
    OracleFormWindow("Vendor").CloseForm

    ' Browse Home
    OracleFormWindow("Function Navigator").OracleTextField("Home").Click

    ' Open Item Inquiry Form
    General_FuncNavOpen "File Maintenance, Item Inquiry"

    ' Verify that the grosss margin percent data are correct
    For x = 1 to numSkus
    OracleFormWindow("Item Inquiry").OracleTextField("SKU #").Enter arrSkus(0,x-1)
    OracleFormWindow("Item Inquiry").OracleButton("Prices & Quantities").Click
    calculatedMargin = CStr(Round(((skuPrice(x - 1) - skuCost(x - 1)) / skuPrice(x - 1)) * 100, 2))
    If OracleFormWindow("Item Inquiry").OracleTextField("Pricing|Margin%").GetROProperty("Value") = calculatedMargin Then
    Reporter.ReportEvent micPass, "Verify Gross Margin Percent on Item Inquiry Form", "Verified that the Gross Margin Percent for SKU# " & arrSkus(0,x-1) & " was correctly displayed at " & calculatedMargin & "%."
    Else
    Reporter.ReportEvent micFail, "Verify Gross Margin Percent on Item Inquiry Form" , "The Gross Margin Percent for SKU# " & arrSkus(0,x-1) & " was " & OracleFormWindow("Item Inquiry").OracleTextField("Pricing|Margin%").GetROProperty("Value") & ". Expected " & calculatedMargin & "%."
    End If
    'Verify Cost data are correct
    OracleFormWindow("Item Inquiry").OracleButton("Vendor Information").Click
    displayedCost = FormatCurrency(OracleFormWindow("Item Inquiry").OracleTable("Vendor Information").GetFieldValue(1," Vendor Pack Cost"))
    If displayedCost = FormatCurrency(skuCost(x - 1)) Then
    Reporter.ReportEvent micPass ,"Verify Vendor Pack Cost on Item Inquiry Form", "Verified that the displayed Vendor Pack Cost for SKU# " & arrSkus(0, x-1) & " was " & displayedCost & "."
    Else
    Reporter.ReportEvent micFail, "Verify Vendor Pack Cost on Item Inquiry Form" , "The displayed Vendor Pack Cost for SKU# " & arrSkus(0, x-1) &" was " & displayedCost & ". Expected " & FormatCurrency(skuCost(x - 1)) & "."
    End if
    Next

    'Close Item Inquiry Form
    OracleFormWindow("Item Inquiry").CloseForm

    ' Browse Home
    OracleFormWindow("Function Navigator").OracleTextField("Home").Click

    ' Open Inventory Items Form
    General_FuncNavOpen "File Maintenance, Inventory Items, Inventory Items Form"

    'Verify data correct in Inventory by site form.
    For x = 1 to numSkus
    OracleFormWindow("Inventory Items").OracleTextField("SKU #").Enter arrSkus(0,x-1)
    JavaWindow("RETAIL.net").PressKey micTab
    OracleFormWindow("Inventory Items").OracleButton("Inventory by Site").Click
    ' Verify Pricing Level 1
    displayedPrice = FormatCurrency(OracleFormWindow("Inventory by Site").OracleTextField("Pricing|Price|Level 1").GetROProperty("Value"))
    If displayedPrice = FormatCurrency(skuPrice(x - 1)) Then
    Reporter.ReportEvent micPass, "Verify Price on Inventory Items Form", "Verified that the pricing for SKU# " & arrSkus(0,x-1) & " was " & displayedPrice & "."
    Else
    Reporter.ReportEvent micFail, "Verify Pricing on Inventory Items Form" , "The Pricing for SKU# " & arrSkus(0,x-1) & " was " & displayedPrice & ". Expected " & FormatCurrency(skuPrice(x - 1)) & "."
    End If
    'Close Inventory by site form
    OracleFormWindow("Inventory by Site").OracleButton("Cancel").Click
    'Open Vendor Info
    OracleFormWindow("Inventory Items").OracleButton("Vendor Info").Click
    'Verify V endor Pack cost in Vendor Infor Form
    displayedCost = FormatCurrency(OracleFormWindow("Vendor Info").OracleTable("Vendor").GetFieldValue(1," Vendor Pack Cost"))
    If displayedCost = FormatCurrency(skuCost(x - 1)) then
    Reporter.ReportEvent micPass ,"Verify Vendor Pack Cost on Inventory Items Form", "Verified that the displayed Vendor Pack Cost for SKU# " & arrSkus(0, x-1) & " was " & displayedCost & "."
    Else
    Reporter.ReportEvent micFail, "Verify Vendor Pack Cost on Inventory Items Form" , "The displayed Vendor Pack Cost for SKU# " & arrSkus(0, x-1) &" was " & displayedCost &". Expected " & FormatCurrency(skuCost(x - 1)) & "."
    End if
    OracleFormWindow("Vendor Info").OracleButton("Cancel").Click
    JavaWindow("RETAIL.net").JavaButton("Cancel Current Action").Click
    Next

    'Close Inventory Items Form
    OracleFormWindow("Inventory Items").CloseForm

    ' Browse Home
    OracleFormWindow("Function Navigator").OracleTextField("Home").Click

    'Clean up test
    Initialize_CleanupTest

  5. #5
    Addicted Member
    Join Date
    Dec 2007
    Posts
    204

    Re: Type mismatch

    Does it highlight or underline any code where it says the type mismatch?

  6. #6

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    8

    Re: Type mismatch

    Right where red colored text with waving hand for attention

    Test Script Setup
    LoadFunctionLibrary Left(Environment.Value("TestDir"), InStrRev(Environment.Value("TestDir"), "\projects")) & "projects\global\functions\lib\Initialize.qfl"
    Initialize_SetupTest

    ' Initialize Variables
    dbCon = Environment.Value("dbOracle")
    importPath = Environment.Value("importPath")
    skuDesc = Environment.Value("skuDesc")
    employeeId = Environment.Value("employeeId")
    password = Environment.Value("password")
    rndVnd = Toolbox_RandStr(7)
    numSkus = 5
    skuPrice = Array(1, 2, 3, 4, 5)
    skuCost = Array(0.5, 0.75, 1, 1.5, 1.75)

    ' Function creates Vendor ID
    vendor_id = QIVendor_Create(dbCon, importPath, "AutoVendor.txt", rndVnd, rndVnd, "1234 FAKE ST", "SALT LAKE CITY", "UT", 84101, "USA", 8015554948)

    'Authenticate: Authorizing Employee, Password, Site Number - OPTIONAL
    General_Login employeeId, password, 1

    ' Ensure we are logged into the correct site
    General_SetSiteNo 1

    '' Verify that the SKU's with the given description do not already exist. If they do, fail the test and exit.
    ' If Not IsEmpty(DbGetArray(dbCon, "select sku_no from invtory where description like '" & skuDesc & "%' order by sku_no"))Then
    ' Reporter.ReportEvent micFail, "SKUs already exist", "The SKUs with the name like '" & skuDesc & "' were already found in the database, so no new SKUs will be created."
    ' Initialize_CleanupTest
    ' ExitTest
    ' End If

    ' Open Inventory Items Form
    General_FuncNavOpen "File Maintenance>Inventory Items>Inventory Items Form"

    ' Ensure that we are in SKU # mode
    If Not JavaWindow("RETAIL.net").JavaList("Item Selection").GetROProperty("value") = "SKU #" Then JavaWindow("RETAIL.net").JavaList("Item Selection").Select "SKU #"

    'Populate Inventory Items Form to create 5 SKUs
    For x =1 to numSkus
    OracleFormWindow("Inventory Items").OracleTextField("Description").Enter skuDesc & " " & x
    OracleFormWindow("Inventory Items").OracleTextField("Dept #").Enter Environment.Value("skuDept")
    OracleFormWindow("Inventory Items").OracleTextField("Class #").Enter Environment.Value("skuClass")
    OracleFormWindow("Inventory Items").OracleTextField("Line #").Enter Environment.Value ("skuLine")
    OracleFormWindow("Inventory Items").OracleTextField("MFG Code").Enter skuDesc & x
    OracleFormWindow("Inventory Items").OracleTextField("Receipt").Click
    OracleFormWindow("Inventory Items").OracleButton("Inventory by Site").Click
    OracleFormWindow("Inventory by Site").OracleTextField("Pricing|Qty|Level 1").Enter "1"
    OracleFormWindow("Inventory by Site").OracleTextField("Pricing|Price|Level 1").Enter skuPrice(x - 1)
    OracleFormWindow("Inventory by Site").OracleCheckbox("Discount Allowed").Select
    OracleFormWindow("Inventory by Site").OracleCheckbox("Allow Price Change").Select
    OracleFormWindow("Inventory by Site").OracleCheckbox("Automatically Replenish").Clear
    OracleFormWindow("Inventory by Site").OracleButton("OK").Click
    If OracleNotification("Confirmation").Exist(3) Then
    OracleNotification("Confirmation").OracleButton("Exclude").Click
    End If
    OracleFormWindow("Vendor Info").OracleTable("Vendor").EnterField 1, "Vendor ID", vendor_id
    OracleFormWindow("Vendor Info").OracleTable("Vendor").EnterField 1, " Vendor Pack Cost", CStr(skuCost(x - 1))
    OracleFormWindow("Vendor Info").OracleButton("OK").Click
    OracleFormWindow("Inventory Items").SelectMenu "File->Save"
    JavaWindow("RETAIL.net").JavaButton("Cancel Current Action").Click
    Next

    ' Close the Inventory Items Form
    OracleFormWindow("Inventory Items").CloseForm

    ' Browse Home
    OracleFormWindow("Function Navigator").OracleTextField("Home").Click

    'Check that the skus to be created now exist
    arrSkus = DbGetArray(dbCon, "select sku_no, description from invtory where description like '" & skuDesc & "%' order by sku_no")
    If Not IsEmpty(arrSkus) Then
    isPass = true
    For i = 0 to UBound(arrSkus,2)
    If Not IsNull(UBound(arrSkus,2)) then
    strResults = strResults & "<tr><td>" & arrSkus(0,i) & "</td><td>" & arrSkus(1,i) & "</td></tr>"
    Else
    strResults = strResults & "<tr><td>" & arrSkus(0,i) & "</td><td>" & arrSkus(1,i) & "</td></tr>"
    isPass = false
    End If
    Next
    If isPass Then
    Call Checkpoint_CustomReporter("Pass", "Verify SKU(s) Exist", "<table class=""tbFormat""><tbody><tr><th>SKU #</th><th>Description</th></tr>" & strResults & "</tbody></table>")
    Else
    Call Checkpoint_CustomReporter("Fail", "Verify SKU(s) Exist","<table class=""tbFormat""><tbody><tr><th>SKU #</th><th>Description</th></tr>" & strResults & "</tbody></table>")
    End If
    Else
    Reporter.ReportEvent micFail, "Verify SKU(s) Exist", "No SKU(s) were found."
    End If

    'Log Out Retail.Net Application
    JavaWindow("RETAIL.net").JavaMenu("File").JavaMenu("Logout").Select

    'Authenticate: Authorizing Employee, Password, Site Number
    General_Login employeeId, password, 1

    ' Open Vendor Form
    General_FuncNavOpen "File Maintenance, Vendor, VendorForm"

    'Populate Vendor and Vendor Items Form
    OracleFormWindow("Vendor").OracleTextField("Vendor ID").Enter vendor_id
    OracleFormWindow("Vendor").OracleTextField("Name").Click
    OracleFormWindow("Vendor").OracleButton("Vendor Items").Click

    'Verify that the Item is in the list and its cost data is correct.
    For x = 1 to numSkus

    If OracleFormWindow("Vendor Items").OracleTable("Vendor Items Table").GetFieldValue(x, "SKU#") = DbGetString(dbCon, "select distinct sku_no from vendor_item where sku_no = " & arrSkus(0, x-1))Then
    Reporter.ReportEvent micPass, "Verify Vendor Item in DB", "The SKU# " & arrSkus(0,x-1) & " was found in the VENDOR_ITEM table."
    Else
    Reporter.ReportEvent micFail, "Verify Vendor Item in DB" , "The SKU# " & arrSkus(0,x-1) & " was not found in the VENDOR_ITEM table."
    End If
    displayedCost = FormatCurrency(OracleFormWindow("Vendor Items").OracleTable("Vendor Items Table").GetFieldValue(x," Vendor Pack Cost"))
    If displayedCost = FormatCurrency(skuCost(x - 1)) then
    Reporter.ReportEvent micPass ,"Verify Vendor Pack Cost on Vendor Form", "Verified that the displayed Vendor Pack Cost for SKU# " & arrSkus(0, x-1) & " was " & FormatCurrency(skuCost(x - 1)) & "."
    Else
    Reporter.ReportEvent micFail, "Verify Vendor Pack Cost on Vendor Form" , "The displayed Vendor Pack Cost for SKU# " & arrSkus(0, x-1) &" was $" & displayedCost & ". Expected $" & FormatCurrency(skuCost(x - 1)) & "."
    End if
    Next
    exittest
    'Close Vendor iTems Form
    OracleFormWindow("Vendor Items").OracleButton("OK").Click

    'Close Vendor Form
    OracleFormWindow("Vendor").CloseForm

    ' Browse Home
    OracleFormWindow("Function Navigator").OracleTextField("Home").Click

    ' Open Item Inquiry Form
    General_FuncNavOpen "File Maintenance, Item Inquiry"

    ' Verify that the grosss margin percent data are correct
    For x = 1 to numSkus
    OracleFormWindow("Item Inquiry").OracleTextField("SKU #").Enter arrSkus(0,x-1)
    OracleFormWindow("Item Inquiry").OracleButton("Prices & Quantities").Click
    calculatedMargin = CStr(Round(((skuPrice(x - 1) - skuCost(x - 1)) / skuPrice(x - 1)) * 100, 2))
    If OracleFormWindow("Item Inquiry").OracleTextField("Pricing|Margin%").GetROProperty("Value") = calculatedMargin Then
    Reporter.ReportEvent micPass, "Verify Gross Margin Percent on Item Inquiry Form", "Verified that the Gross Margin Percent for SKU# " & arrSkus(0,x-1) & " was correctly displayed at " & calculatedMargin & "%."
    Else
    Reporter.ReportEvent micFail, "Verify Gross Margin Percent on Item Inquiry Form" , "The Gross Margin Percent for SKU# " & arrSkus(0,x-1) & " was " & OracleFormWindow("Item Inquiry").OracleTextField("Pricing|Margin%").GetROProperty("Value") & ". Expected " & calculatedMargin & "%."
    End If
    'Verify Cost data are correct
    OracleFormWindow("Item Inquiry").OracleButton("Vendor Information").Click
    displayedCost = FormatCurrency(OracleFormWindow("Item Inquiry").OracleTable("Vendor Information").GetFieldValue(1," Vendor Pack Cost"))
    If displayedCost = FormatCurrency(skuCost(x - 1)) Then
    Reporter.ReportEvent micPass ,"Verify Vendor Pack Cost on Item Inquiry Form", "Verified that the displayed Vendor Pack Cost for SKU# " & arrSkus(0, x-1) & " was " & displayedCost & "."
    Else
    Reporter.ReportEvent micFail, "Verify Vendor Pack Cost on Item Inquiry Form" , "The displayed Vendor Pack Cost for SKU# " & arrSkus(0, x-1) &" was " & displayedCost & ". Expected " & FormatCurrency(skuCost(x - 1)) & "."
    End if
    Next

    'Close Item Inquiry Form
    OracleFormWindow("Item Inquiry").CloseForm

    ' Browse Home
    OracleFormWindow("Function Navigator").OracleTextField("Home").Click

    ' Open Inventory Items Form
    General_FuncNavOpen "File Maintenance, Inventory Items, Inventory Items Form"

    'Verify data correct in Inventory by site form.
    For x = 1 to numSkus
    OracleFormWindow("Inventory Items").OracleTextField("SKU #").Enter arrSkus(0,x-1)
    JavaWindow("RETAIL.net").PressKey micTab
    OracleFormWindow("Inventory Items").OracleButton("Inventory by Site").Click
    ' Verify Pricing Level 1
    displayedPrice = FormatCurrency(OracleFormWindow("Inventory by Site").OracleTextField("Pricing|Price|Level 1").GetROProperty("Value"))
    If displayedPrice = FormatCurrency(skuPrice(x - 1)) Then
    Reporter.ReportEvent micPass, "Verify Price on Inventory Items Form", "Verified that the pricing for SKU# " & arrSkus(0,x-1) & " was " & displayedPrice & "."
    Else
    Reporter.ReportEvent micFail, "Verify Pricing on Inventory Items Form" , "The Pricing for SKU# " & arrSkus(0,x-1) & " was " & displayedPrice & ". Expected " & FormatCurrency(skuPrice(x - 1)) & "."
    End If
    'Close Inventory by site form
    OracleFormWindow("Inventory by Site").OracleButton("Cancel").Click
    'Open Vendor Info
    OracleFormWindow("Inventory Items").OracleButton("Vendor Info").Click
    'Verify V endor Pack cost in Vendor Infor Form
    displayedCost = FormatCurrency(OracleFormWindow("Vendor Info").OracleTable("Vendor").GetFieldValue(1," Vendor Pack Cost"))
    If displayedCost = FormatCurrency(skuCost(x - 1)) then
    Reporter.ReportEvent micPass ,"Verify Vendor Pack Cost on Inventory Items Form", "Verified that the displayed Vendor Pack Cost for SKU# " & arrSkus(0, x-1) & " was " & displayedCost & "."
    Else
    Reporter.ReportEvent micFail, "Verify Vendor Pack Cost on Inventory Items Form" , "The displayed Vendor Pack Cost for SKU# " & arrSkus(0, x-1) &" was " & displayedCost &". Expected " & FormatCurrency(skuCost(x - 1)) & "."
    End if
    OracleFormWindow("Vendor Info").OracleButton("Cancel").Click
    JavaWindow("RETAIL.net").JavaButton("Cancel Current Action").Click
    Next

    'Close Inventory Items Form
    OracleFormWindow("Inventory Items").CloseForm

    ' Browse Home
    OracleFormWindow("Function Navigator").OracleTextField("Home").Click

    'Clean up test
    Initialize_CleanupTest

  7. #7
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Type mismatch

    Code:
    If OracleFormWindow("Vendor Items").OracleTable("Vendor Items Table").GetFieldValue(x, "SKU #") = DbGetString(dbCon, "select distinct sku_no from vendor_item where sku_no = " & arrSkus(0, x-1))Then
    The problem is that I have no idea what "OracleFormWindow("Vendor Items").OracleTable("Vendor Items Table").GetFieldValue(x, "SKU #")" Expects as a parameter nor what it returns
    Same for
    Code:
     DbGetString(dbCon, "select distinct sku_no from vendor_item where sku_no = " & arrSkus(0, x-1))
    Clearly either one or more of your parameters is the wrong type or those 2 methods return a different type

    Also note that the code you posted needs to be enclosed with [code][/code] to retain formatting as is it is far to difficult to read

  8. #8

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    8

    Re: Type mismatch

    I am new to the forum....new to the coding and new to QTP.

    This script is for automation, where the developer is creating a new item and then matching the field value to be present in the database.
    I have noted your comment will do it from the next time.
    Last edited by Surabhi; Feb 28th, 2013 at 04:04 PM. Reason: mistake

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width