HomeSUPPORT QUESTIONS

Need help with StresStimulus? Start here.

Help on C# Scriptable Vars - extractor value Messages in this topic - RSS

clinares
clinares
Posts: 3


2/10/2020
clinares
clinares
Posts: 3
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
George @StresStimulus
Administrator
Posts: 285


2/11/2020
George @StresStimulus
George @StresStimulus
Administrator
Posts: 285
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
clinares
Posts: 3


2/11/2020
clinares
clinares
Posts: 3
Great thanks, this is what I was looking for.
0 link






Copyright © 2020 Stimulus Technology