NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Delete subproperty

Solved!
Go to solution

I wanted to delete a Station global container with stored results init.

 

The expression I used is 

 

StationGlobals.StoredResults.DeleteSubProperty(Parameters.Step.Name,0x400000)

 

Parameter.Step.Name is my lookup string. and in property Option I tried using 0x400000 to override Notdeletable variable.

 

Problem here is, it works for few execution like there is no problem in deleting the subproperty for 4 or 5 times. After that it is not deleting that subproperty.

 

And the same problem I couldnt see in OperatorMode. This problem is occuring only in sequence editor. I am using TestStand Ver4.2.1.

 

Is there any workaround for this or any other option to forcefully delete the subproperty.

 

Thanks in Advance,

 

Vijayakumar M

Larsen and Toubro Limited,

Mysore. India.

0 Kudos
Message 1 of 11
(5,186 Views)

Hi,

 

Do you have a small example highlighting the program?

 

How does your sequence create "StationGobals.StoredResults.Parameters.Step.Name"?

 

Regards

Ray Farmer

Regards
Ray Farmer
Message 2 of 11
(5,181 Views)

Hi,

 

First am creating a Test.Stored Results empty container with below expression,

 

StationGlobals.NewSubProperty("Test.StoredResults",PropValType_Container,False,"",0)

 

Then I will create a subproperty with the name under stored results container.

 

StationGlobals.Test.StoredResults.NewSubProperty(Parameters.Step.Name,PropValType_Container,False,"",0)

 

To delete the same am using this below one.

 

StationGlobals.Test.StoredResults.DeleteSubProperty(Parameters.Step.Name,0x400000)

 

Basically my requirement in this,  is to store the previous result in station global. Am using clone and SetpropertyObject to copy the results.

 

The flow as such it works fine for few execution in TS sequence Editor. 

 

I thought there may be something like sequence editor will have some temp buffer to store these result, if we delete and create again and again there might be some problem.

0 Kudos
Message 3 of 11
(5,174 Views)

So you are really storing a variable:

 

StationGlobals.Test.StoredResults.YourName

 

I'm not sure why you are using 0x400000, that should not be necessary unless you are setting the notdeleteable flag on your properties.

 

One issue that you might not be aware of is that step names can contain any characters, but subproperty names cannot. Using an array of Containers rather than subproperties is the way to handle this if you need to support any characters (i.e. '.' and ' ', etc. in the name) in your names because array element names can also be anything. Basically make StoredResults an array of containers and insert your new properties into it as elements of the array (you can then give them anything for the name). This might or might not be related to the issue you are seeing, but it's definitely an issue if you are using step names.

 

Is Parameter.Step an actual step or just a container called step?

 

Do you have multiple threads running in parallel accessing the station globals?

 

There is no known issue which should keep you from deleting a station global. Perhaps if you attach an example sequence which reproduces the problem we will be better able to help you.

 

Hope this helps,

-Doug

0 Kudos
Message 4 of 11
(5,166 Views)

So you are really storing a variable:

 

StationGlobals.Test.StoredResults.YourName

 

-Yes

 

I'm not sure why you are using 0x400000, that should not be necessary unless you are setting the notdeleteable flag on your properties.

 

 - I tried using this property option to delete even if it is not deletable. (I just tried)

 

One issue that you might not be aware of is that step names can contain any characters, but subproperty names cannot. Using an array of Containers rather than subproperties is the way to handle this if you need to support any characters (i.e. '.' and ' ', etc. in the name) in your names because array element names can also be anything. Basically make StoredResults an array of containers and insert your new properties into it as elements of the array (you can then give them anything for the name). This might or might not be related to the issue you are seeing, but it's definitely an issue if you are using step names.

 

- I have taken care in Step name not to have any special character init like space etc. (Its working fine)

 

Is Parameter.Stepname an actual step or just a container called step?

 

 Its is actually a Step with sequence call. Am calling Subseqence in Main sequence and Storing results of the subsequnce in Station global.

 

Do you have multiple threads running in parallel accessing the station globals?

 

- No.

 

There is no known issue which should keep you from deleting a station global. Perhaps if you attach an example sequence which reproduces the problem we will be better able to help you.

 

 - Even am wondering why its not able delete after few execution. But I do agree that Stored result container is really big.

 

Here with I attached a example sequence.. am not able to send fullsequence since its very big with 80 subsequences ini.

 

 

Thanks

Vijay

0 Kudos
Message 5 of 11
(5,142 Views)

There are a couple of problems with the sequence file you attached.

 

1) In your  SequenceFilePostResultListEntry sequence the data type of Locals.StepResult was container, it should be Object Reference instead. It wouldn't even run in my version of TestStand, I got a runtime error. What version of TestStand are you using? Does it run in that version? If so that might be the source of your problem, as it would have to be making the cloned version a child of Locals and if so then using it later with SetPropertyObject is incorrect because it already has a parent (i.e. Locals). You should change the type of Locals.StepResult to Object Reference instead. Or you can even do the call to Parameters.Result.Clone("", 0) inline as an argument to SetPropertyObject().

 

2) What you are trying to do in that sequence can be greatly simplified. The following expression is all you need for that entire sequence (you only need one statement step with this in it):

 

Locals.StepResult = Parameters.Result.Clone("",0),
StationGlobals.SetPropertyObject("Test.StoredResults." + Parameters.Step.Name, 1 /* InsertIfMissing */ ,Locals.StepResult)

 

Is this sequence sufficient to reproduce the problem? I was unable to do so, perhaps because of my changes above, or perhaps there is something else different in your actual use case.

 

Hope this helps,

-Doug

0 Kudos
Message 6 of 11
(5,132 Views)

Hi ray,

 

Yes, we do.

I have attached the steps that we use in SequenceFilePostResultListEntry callback.

In this steps, in the !skipped condition, TS is not able to delete the subproperty for some reason and does not return error.

and in the next step TS is not able to create the subproperty for some reason and does not return error and in the next step TS is supposed create a clone of the step result and assign the created StationGlobal varaible with the step result. This is where it throws an error, attached.

Could you find any problem here?

 

Download All
0 Kudos
Message 7 of 11
(5,121 Views)
Solution
Accepted by Vijay@M

Hi Share_Good,

 

There were a couple of issues with the file you attached. I have made some changes which I think make it work the way you intended and simplify things. I added comments to the file to help explain the changes. Please let me know if you have any questions regarding the changes. I was unable to reproduce the error you posted, but I think these changes might resolve the problem because one of the issues I fixed involved not cloning the property you got using GetPropertyObject before setting another property to have that as it's suproperty (A property object can only have one parent, so you need to make a copy and store the copy not the original). Also, make sure your Locals.StepResult is an Object Reference variable like I have it in the attached sequence file rather than a container.

 

I also created a version of the file, SequenceFilePostResultListEntry2.seq, which uses an array of containers to store the results rather than subproperties, which allows the step names to be anything including having spaces and '.' characters.

 

Hope this helps,

-Doug

0 Kudos
Message 8 of 11
(5,109 Views)

Hi Dug,

 

Thanks a lot.

This works well.

I am not sure why the steps that i have made were not working (they do work some times, dont know how)

0 Kudos
Message 9 of 11
(5,096 Views)

I figured out how to reproduce the problem and the cause. To reproduce it with your original code you have to first run the mainsequence with one step skipped, and then run it again with that step set to normal. The cause is as I suspected, in the skipped case, when you take the PropertyObject you get directly from the GetPropertyObject call and set Parameter.Result with it you were effectively reparenting it (GetPropertyObject returns the actual property, not a copy), but since an object can only have one parent, when Parameter.Result's parent goes away (it's parent is the Locals.ResultList of the mainsequence) after the execution is done, the version of the property in the globals that thinks it's the parent really isn't. The error message you got means that you are trying to call SetPropertyObject on a top-level (non-child) property which is not supported. The reason it thinks it's a top-level property is because its most recent parent has already gone away. Ideally TestStand should probably have given you an error when you tried to do the original SetPropertyObject with an object that already had a parent. I'll record this as an issue for investigation.

 

At any rate, the Clone() call I added to the step fixes the problem because you are now storing a copy in Parameter.Result and leaving the original version in the globals unchanged.

 

NOTE: If you have machines on which you haven't restarted teststand or deleted the globals, their globals might still be in a bad state so even with the fixed code, you could still get the error until you restart teststand or delete the globals.

 

Hope this helps explain things,

-Doug

Message Edited by dug9000 on 02-10-2010 09:46 AM
Message 10 of 11
(5,093 Views)