Forum Discussion

abrar22's avatar
abrar22
Frequent Contributor
7 years ago

Pass parameter vale in Aliases?

Hi,

 

I am trying to pass the value through parameter in Aliases but its throwing runtime error. Please help

 

function FXConnectRFSClientAllin(Val)
{
var intValue= Aliases.jp2launcher.JideSystemShell.Orders.exec_orders.RootPane.null_layeredPane.null_contentPane.SessionDetailsTabbedPanel.Panel.JideTabbedPane.BusyComponent.JXLayer.MultiOrderCardPanel.RFS_Competitive.JS_RFSOrderDetails.wValue(Val)
return intValue
}

 

Value i am passing is '0,15'

 

A

  • Type Mismatch error show me that, you have convert your string to int.

    try like below,

     

    function FXConnectRFSClientAllin(rowValue, ColValue) {
    	try {
    		rowValue = aqConvert.VarToInt(rowValue);
    		ColValue = aqConvert.VarToInt(ColValue);
    	} catch (ex) {
    		Log.Error("Invalid inputs");
    		return;
    	}
    	var intValue = Aliases.jp2launcher.JideSystemShell.Orders.exec_orders.RootPane.null_layeredPane.null_contentPane.SessionDetailsTabbedPanel.Panel.JideTabbedPane.BusyComponent.JXLayer.MultiOrderCardPanel.RFS_Competitive.JS_RFSOrderDetails.wValue(rowValue, ColValue);
    	return intValue
    }

     

  • Try using that alias outside the function to assign a variable value and hard code the value in.  That will help narrow down the issue.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    OK, first of all, everything I'm saying after this sentence is based upon guess. 

     

    My GUESS... is that you're using a JavaScript project.  In the JavaScript implementation in TestComplete, there are limitations on operating on properties that are accessed via index, like wValue in your code example.  In these situations you need to use $set and $get to work with properties that have indices.

     

    Change your code to the following:

     

    function FXConnectRFSClientAllin(Val)
    {
    var intValue= Aliases.jp2launcher.JideSystemShell.Orders.exec_orders.RootPane.null_layeredPane.null_contentPane.SessionDetailsTabbedPanel.Panel.JideTabbedPane.BusyComponent.JXLayer.MultiOrderCardPanel.RFS_Competitive.JS_RFSOrderDetails.$get('wValue', Val)
    return intValue
    }

    One other item of note... you might want to redo your Aliases.  There are a lot of aliases in your string that appear to be just place holders in the hierarchy.  If you're not interacting directly with "null_layeredPane", it doesn't need to have an Alias.  It is probably mapped and that can remain, but you might want to look at "compressing" your Aliases into more usable strings.  See https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/overview.html#about-the-mapped-objects-and-aliases-trees

  • shankar_r's avatar
    shankar_r
    Community Hero

    I guess 0,15 is row and column number to get value using wValue(row,column) method.

     

    If i assume correctly, then you have to pass two parameters in order to get the value, as like below.

     

    function FXConnectRFSClientAllin(rowValue,ColValue)
    {
    var intValue= Aliases.jp2launcher.JideSystemShell.Orders.exec_orders.RootPane.null_layeredPane.null_contentPane.SessionDetailsTabbedPanel.Panel.JideTabbedPane.BusyComponent.JXLayer.MultiOrderCardPanel.RFS_Competitive.JS_RFSOrderDetails.wValue(rowValue,ColValue);
    return intValue
    }
    • abrar22's avatar
      abrar22
      Frequent Contributor

      Tried this but still getting the runtime error as 'Type mismatch'

      • shankar_r's avatar
        shankar_r
        Community Hero

        Can you post a screenshot where you are getting type mismatch error?