I need to pull the value of a variable in a child package to the parent package. I can not get this to work.
I can set variables from parent to child using package configurations, but I cant find a way to get child value into parent. I tried using same process I used to set value from parent in child but it does not work.
The posted possible solution from another topic did not solve the problem it just stated it may not be possible. The post was from 2013 and a lot of things change, I wanted to see if this is possible now (without saving a value to an external table or anything like that).
This child package is being used in a lot of spots, many of which would not have the parent variable I am trying to set (it would not exist in the parent variable). So the standard script in the post above would not work. I was hoping for a simple return variable value.
Using the above post as a starting point I updated the C# code to check to see if the variable I am trying to set in the parent package exists first (because it would not always be there), then if so set it.
Below is the code I came up with
// have to do this FIRST so you can access variable without passing it into the script task from SSIS tool box
// Populate collection of variables.
//This will include parent package variables.
Variables vars = null;
Dts.VariableDispenser.GetVariables(ref vars);
// checks if this variable exists, and if so then will set it to the value of the child variable
if (Dts.VariableDispenser.Contains("ParentVar") == true)
{
//MessageBox.Show("ParentVariableExists");
// Lock the to and from variables.
// parent variable
Dts.VariableDispenser.LockForWrite("User::ParentVar");
// child variable
Dts.VariableDispenser.LockForRead("User::ChildVar");
// Apparently need to call GetVariables again after locking them.
// Not sure why - perhaps to get a clean post-lock set of values.
Dts.VariableDispenser.GetVariables(ref vars);
// parentvar = childvar
vars["User::ParentVar"].Value = vars["User::ChildVar"].Value;
vars.Unlock();
}
You can put the variable in the parent package, and let the child package modify it.
Another sure-fire way is to populate a table in the child package and read the table in the parent package.
I want to add nodes of a model to btDynamicsWorld with btBvhTriangleMeshShape. I can do this with the whole model by passing model.meshpart, but nodes does not have meshparts.
I need this because only the required nodes need to be added to btDynamicsWorld.
See the wiki: https://github.com/libgdx/libgdx/wiki/Bullet-Wrapper---Using-models
It's one line:
btCollisionShape shape = Bullet.obtainStaticNodeShape(model.nodes);
You can pass in as many nodes you like (or just one, if you prefer).
If I have a variable in one external action script, is it possible for me to access it in another external action script? Also, how would I do that?
Many ways. I have no idea what you mean be 'external,' but if you are talking about two classes, an instance of one of which adds, as a Child, an instance of another you can do one of the following.
If the Child wants to refer to a variable on the parent:
var childvariable = parent.parentvariable
or
var childvariable = MovieClip(parent).parentvariable
note that the parent variable should be declared as a public var in the parent class if the parent is in a different 'package' than the child.
If the parent wants to refer to a variable on the Child:
Child.childvariable = something
or
var newvariable = Child.childvariable
You can refer to a variable on a class (instead of an instance of a class) by first declaring the variable as a static var or static const and the referring to as:
Classname.variable
There are other ways to refer to variables on sibling instances. Maybe you could ask a more specific question.
What's the difference between these two method groups in terms of the set of classes they work with (i.e. ApplicationDomain's class definition set vs the set of class definitions getDefinitionByName uses)?
ApplicationDomain. getDefinition / hasDefinition / getQualifiedDefinitionNames (Flash Player 11.3+ only, undocumented)
getDefinitionByName
It's clear that there's an application domain hierarchy and that definitions may be visible in some app domains and not others. For example, would ApplicationDomain.getDefinition return a definition that is not defined in the given app domain but is accessible from it? (e.g. if the domain is a child domain and we're looking up a definition defined in the parent?) The documentation for ApplicationDomain just says "Loaded classes are defined only when their parent doesn't already define them." but it also says "(ApplicationDomains) allow multiple definitions of the same class to exist and allow children to reuse parent definitions."
The documentation also indicates that getDefinitionByName returns class definitions, whereas ApplicationDomain.getDefinition will return namespace and function definitions in addition to class definitions.
Assuming I'm only interested in class definitions, what ApplicationDomains does getDefinitionByName search? (e.g. all domains, the current/caller domain only, or any domains accessible to the caller?)
This initial test is confusing:
import flash.system.ApplicationDomain;
var d:ApplicationDomain = new ApplicationDomain( ApplicationDomain.currentDomain ); //child of current domain
trace(ApplicationDomain.currentDomain.hasDefinition("flash.display.DisplayObject")); //true
trace(ApplicationDomain.currentDomain.getQualifiedDefinitionNames().length); //1 (the main timeline class definition only: Untitled_fla::MainTimeline)
trace(d.hasDefinition("flash.display.DisplayObject")); //false
In the above test, on the one hand, getQualifiedDefinitionNames reports that only the main timeline class is defined in the current app domain, yet getDefinition returns true for DisplayObject, indicating it reports the existence of definitions in the parent (system) domain, yet the final trace on the grandchild domain contradicts that by returning false.
ApplicationDomain.currentDomain.parentDomain also returns null, which directly contradicts the following documentation statements: "The system domain contains all application domains, including the current domain..." and "Every application domain, except the system domain, has an associated parent domain. The parent domain of your main application's application domain is the system domain."
The contradiction is very apparent here, where currentDomain has the definition, but when you create a child domain and access the parent, which should be currentDomain, it suddenly reports that it doesn't contain the definition:
trace(ApplicationDomain.currentDomain.hasDefinition("flash.display.DisplayObject")); //true
trace((new ApplicationDomain( ApplicationDomain.currentDomain )).parentDomain.hasDefinition("flash.display.DisplayObject")); //false! why?
This page is quite comprehensive: http://www.senocular.com/flash/tutorials/contentdomains/?page=2 I've managed to solve a couple mysteries, but the basic question outlined above (particularly concerning the scope of getDefinitionByName) still stands. I just wanted to post an answer for what I was able to resolve.
Retreiving the parentDomain returns null if the parent is the system domain. So although the parentDomain is the system domain, the parentDomain property returns null anyway. That's just the way it is. Unfortunately, that makes the system domain inaccessible, for example, for class enumeration through getQualifiedDefinitionNames.
Concerning my initial test, it seems that constructing a new ApplicationDomain creates a dead object until a SWF is actually loaded under that domain. For example, creating a child domain of the current domain and calling hasDefinition on it will return false, but if you assign that very same instance to a loader context an pass it to Loader.load, once the load completes, you can call hasDefinition on the instance that originally returned false, and it will return true instead. So you can construct an ApplicationDomain with a parent, but it won't really function until it's being actively used.
var d:ApplicationDomain = new ApplicationDomain( ApplicationDomain.currentDomain ); //child of current domain
trace(d.hasDefinition( "flash.display.DisplayObject" )); //false for now...
var l:Loader = new Loader();
l.load(new URLRequest( "any.swf"), new LoaderContext( false, d ) );
l.contentLoaderInfo.addEventListener( Event.COMPLETE, completed, false, 0, true );
function completed(e:Event ):void
{
trace(d.hasDefinition( "flash.display.DisplayObject" ); //...and now it's true.
}
So it would seem that ApplicationDomain.getDefinition does report classes in the parent, grandparent, etc. domains, but it will only do so after the new ApplicationDomain instance has been activated through loading something into it.
Also, ApplicationDomain instances may refer to the same application domain, but they cannot be directly compared. For example, (ApplicationDomain.currentDomain == ApplicationDomain.currentDomain) is false.
My OData model contains a pair of entities with many-to-many relationship (Parents-Children). I am trying to add a child entity to a parent's Children navigation property, but calling saveChanges() afterwards has no effect at all. The code looks something like:
// both 'parent' and 'child' are attached to the context
// both have their navigation properties empty
parent.Children.push(child);
context.saveChanges();
I have also tried:
parent.Children = parent.Children.concat([child]);
parent.Children = [child];
But to no avail, it still doesn't work - the saveChanges() call doesn't make any requests to the service, as if there is nothing to update.
I'd really appreciate an example of how to work with many-to-many relations using JayData, and some help dealing with the issue described above.
Thanks