Page 1 of 1

Pass the Repository Item as an Object to a Function

Posted: Fri Oct 14, 2016 10:12 pm
by nivasd16
Hi Team
My scenario i am writing common function in a class to retrieve the RowCount/colCounf of an SAP Table Object

As this function is common for all the table object, i just pass this repository reference table object to that function so that


Below is the code i tried

var GridRepo=HCM.Framework.HCM.ObjectRepositories.SAP_GUI.WorkFlow.TCodeRepo.Instance;

var GridObj=GridRepo.SAP_GUI.S_PH0_48000510_InfoSetQuery.Grd_QueryInputs;



i need to pass the GridObj as an object to a fucntion

i tried like
DatabaseIO.SAP_GridRowCount(GridObj);

public static void SAP_GridRowCount(Ranorex.Core.Repository.RepositoryItem Grid)
{
}

Got the error messages as

Argument 1: cannot convert from 'Ranorex.Table' to 'Ranorex.Core.Repository.RepositoryItem' (CS1503) - \\NASPRD01094P04\PRD_ISQA_Automation_Users\srinivasulareddy\ranorex\HCM\HCM.TestSuite\OM\Create_Position.cs:56,32

The best overloaded method match for 'HCM.Framework.HCM.Modules.Common.TestData.DatabaseIO.SAP_GridRowCount(Ranorex.Core.Repository.RepositoryItem)' has some invalid arguments (CS1502) - \\NASPRD01094P04\PRD_ISQA_Automation_Users\srinivasulareddy\ranorex\HCM\HCM.TestSuite\OM\Create_Position.cs:56,4

Re: Pass the Repository Item as an Object to a Function

Posted: Mon Oct 17, 2016 8:17 am
by odklizec
Hi,

You need to declare the repository element as "repoiteminfo" (Ranorex.Core.Repository.RepoItemInfo) or "adapter" (Ranorex.Adapter). Hope this helps?

Re: Pass the Repository Item as an Object to a Function

Posted: Mon Oct 17, 2016 7:08 pm
by nivasd16
odklizec wrote:Hi,

You need to declare the repository element as "repoiteminfo" (Ranorex.Core.Repository.RepoItemInfo) or "adapter" (Ranorex.Adapter). Hope this helps?

Thanks for the input.. If possible can you give me example on how to use the adapter


Regards
Srinivas

Re: Pass the Repository Item as an Object to a Function

Posted: Tue Oct 18, 2016 6:46 am
by odklizec
Hi,

Because I don't have a clue what exactly you would like to achieve, it's hard for me to give you an example how to use Ranorex Adapter. I would suggest to start with Ranorex code samples available here:
http://www.ranorex.com/support/user-gui ... mples.html

And of course, this forum is a great source of knowledge, simply search for "adapter" keyword ;)

Re: Pass the Repository Item as an Object to a Function

Posted: Tue Oct 18, 2016 2:17 pm
by krstcs
In addition, take a look at the Ranorex API documentation here: http://www.ranorex.com/Documentation/Ranorex/