Highlighted
Absent Member.
Absent Member.
732 views

How to paramerize a function in Truclient

Jump to solution

Truclient: 12.53

So I have a function in truclient that I would like to use throughout my script but with different data. Is there a way to send that function what parameter is would like it to use?

1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

Re: How to paramerize a function in Truclient

Jump to solution

Thank you everyone for your input.

Myself and a Co-Worked figured this out.  You have to use the arguments section in the fucntion. Once you have the argument set up in the function then add "FuncArgs.Your_Var".  Then when calling the function tell it what you want to pass using the arguments section there as well. This way you can send what ever data you want to that function and it will use it.

 

 

View solution in original post

5 Replies
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: How to paramerize a function in Truclient

Jump to solution

Look for the details on TC.getParam

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: How to paramerize a function in Truclient

Jump to solution

I'm not sure if TC.getParam will work.

So heres an example of what I'm wanting to do.

Say I have a script that inside of it, it googles something.

So I make a funciton to go to google and search a value.

The issue is that this value that I'm googling for changes in the different parts of my scipt.

A= Test

B=Automation

So I Call the "Google" function one time and need it to use "A" then later down the script I need it to use "B".

I've been playing with Funciton Arguments but I'm not sure this is the right path.

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: How to paramerize a function in Truclient

Jump to solution

Any thoughts on this? Has anyone ever tried this in Truclient?

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: How to paramerize a function in Truclient

Jump to solution

It sound like TC.getParam and TC.advanceParam can help you with your use case.

I suggest you read about parametrization in LoadRunner documentation. There are several parameter types in strategies for advancing the parameter cursor. TC.getParam is just requesting for a value. The strategy and behavior is defined in the parameter itself.

Good luck,

Shlomi

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: How to paramerize a function in Truclient

Jump to solution

Thank you everyone for your input.

Myself and a Co-Worked figured this out.  You have to use the arguments section in the fucntion. Once you have the argument set up in the function then add "FuncArgs.Your_Var".  Then when calling the function tell it what you want to pass using the arguments section there as well. This way you can send what ever data you want to that function and it will use it.

 

 

View solution in original post

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.