Pass the Repository Item as an Object to a Function

Class library usage, coding and language questions.
nivasd16
Posts: 14
Joined: Fri Jan 22, 2016 11:17 pm

Pass the Repository Item as an Object to a Function

Post by nivasd16 » Fri Oct 14, 2016 10:12 pm

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

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3914
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Mon Oct 17, 2016 8:17 am

Hi,

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

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

nivasd16
Posts: 14
Joined: Fri Jan 22, 2016 11:17 pm

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

Post by nivasd16 » Mon Oct 17, 2016 7:08 pm

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

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3914
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Tue Oct 18, 2016 6:46 am

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 ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

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

Post by krstcs » Tue Oct 18, 2016 2:17 pm

In addition, take a look at the Ranorex API documentation here: http://www.ranorex.com/Documentation/Ranorex/
Shortcuts usually aren't...