Need help with StresStimulus? Start here.
Help on C# Scriptable Vars - extractor value
clinares Posts: 3
2/10/2020
|
Folks,
Is there a guide on how to use the scriptable vars, I am coding in C# and I want to make a reference of a Extraced variable into my C# code:
string IExternalVariable.GetValue(SessionContext context) { string text= File.ReadAllText(@"c:\file.txt", Encoding.UTF8); return text;
//throw new NotImplementedException(); }
I want to read the file from the extracted parameter from a correlation, I believe this can come come the context object, but cant find any help on this.
|
|
0
link
|
George @StresStimulus Administrator Posts: 567
2/11/2020
|
The SessionContext object is described http://support.stresstimulus.com/display/doc51/SessionContext You can access the correlation values from the ExtractorRuntime that is described http://support.stresstimulus.com/display/doc51/ExtractorRuntime
From what I understood, you created an extractor that is a file name and you want to return its content. Assuming the name of the extractor is “MyFileName” here is the code:
string IExternalVariable.GetValue(SessionContext context) { string text= File.ReadAllText(context.ExtractorRuntime.GetExtractorValue(“MyFileName”), Encoding.UTF8); return text; }
|
|
0
link
|
clinares Posts: 3
2/11/2020
|
Great thanks, this is what I was looking for.
|
|
0
link
|
Copyright © 2025 Stimulus Technology