NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

FileGlobals access problem in TestStand using C#.NET

Hi, all
Here I pasted code for access file of sequence file.
I created interger type variable under "FileGlobals" and tried to accees same from programetically, but I can't do that.
Pleasem, correct the code if any thing wrong and explain it.

private

void IncreamentStepNum(SequenceContext paraSeqContext)

{

double nStepNum = 0;

PropertyObject objStepProperty = paraSeqContext.FileGlobals

if (objStepProperty.Exists("StepNumber", 0)) // it's always "FALSE"

{

nStepNum = objStepProperty.GetValNumber("StepNumber", 0); // Created Integer type variable under "FileGlobals" option

MessageBox.Show("Success");

nStepNum = nStepNum + 1;

objStepProperty.SetValNumber("StepNumber", PropertyOptions.PropOption_InsertIfMissing, nStepNum);

}

}

}

Thank you,

regards

Rkk



Message Edited by rkk on 02-22-2008 05:56 AM
0 Kudos
Message 1 of 7
(4,414 Views)
Hi ,
 
Try this:
PropertyObject objStepProperty = paraSeqContext.FileGlobals  // Wrong!!

PropertyObject objStepProperty = paraSeqContext.AsPropertyObject().GetPropertyObject("FileGlobals",0);

Greetings
Juergen:

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 2 of 7
(4,408 Views)

Hi Juergen,

Thank you for reply. But still same problem.

My Code looks like

PropertyObject

objStepProperty = paraSeqContext.AsPropertyObject().GetPropertyObject("FileGlobals",0)

if (objStepProperty.Exists("StepNumber", 0)) // always "false"

{

nStepNum = objStepProperty.GetValNumber(

"StepNumber", 0);

MessageBox.Show("Success");

nStepNum = nStepNum + 1;

objStepProperty.SetValNumber(

"StepNumber", PropertyOptions.PropOption_InsertIfMissing, nStepNum);

}

0 Kudos
Message 3 of 7
(4,388 Views)

Hi rkk,

Are you sure you have "FileGlobals.StepNumber" in your sequence file that the step is executing in. Remember that if this step is in another sequencefile from the MainSequence then unless you have set the sequence file properties to use a common file globals then you may not have access to the FileGlobals you are looking for.

From the SequenceContext you should be able to get a reference to the FileGlobals which is a PropertyObject. Then you should be able to get / set the value of that FileGlobals.

eg if I had a variable called FileGlobals.MyNumber which had the value of 5

The following API calls would be

seqfileFGPropObj = SequenceContext.FileGlobals() (use thisContext as the reference)

Locals.result = PropertyObject("MyNumber", 0) (use seqfileFGPropObj as the reference)

 

hope this helps

Regards

Ray Farmer

 

Regards
Ray Farmer
0 Kudos
Message 4 of 7
(4,387 Views)
Hi rkk,
 
If the problem is still present, just post a small exapmle that Ray or I can take a look into it.
 
Greetings
 
Juergen 
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 5 of 7
(4,382 Views)
Hi Ray Farmer,
What u r telling that's right. My steps are referenced by another sequence file. I hope need to declare same varible into referenced file.Is it correct what i am looking for?
 
Here my steps type are "Sequence call". Please post eg. on this type
 
Thank you.
regards
RKK
0 Kudos
Message 6 of 7
(4,378 Views)
Hi,
 
you must specify the same variable in all sequence files or use the option set to 1 "InsertIfMissing"
 
 

PropertyObject objStepProperty = paraSeqContext.AsPropertyObject().GetPropertyObject("FileGlobals",1)

 

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 7 of 7
(4,355 Views)