Unable to set a temporary attribute

A place for Ventity software questions & answers
Post Reply
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Unable to set a temporary attribute

Post by Jack Harich »

This is a two-hour puzzle. See News Org action G5_2 Create News Org MMs. The value of Invoker.temp PoliticianID is never set, as seen in the News Orgs results table. This causes many warnings.

Compare this to Voter action G3_1 Create Politician Comparison which also sets a temporary attribute value, in almost the exact same manner.

I’m using lots of temporary variables, since Ventity triggers and actions appear to have no equivalent of passing arguments in a function call. This creates a lot of clutter. Is there a better way? Thanks.
Attachments
RDem 97.zip
(90.2 KiB) Downloaded 403 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Unable to set a temporary attribute

Post by tomfid »

I think this may have been saved before the invoker attribute surrogate was defined, because for me there's nothing on the action view except a local attribute, "source type". What should the temp ID be set to?
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: Unable to set a temporary attribute

Post by Jack Harich »

Thanks. Are we looking at the same diagram? "source type" is nowhere on News Org action G5_2 Create News Org MMs. See the image.

The especially odd thing is temp politician truthfulness IS being set.
PostCreateNewsOrgsMMs.png
PostCreateNewsOrgsMMs.png (45.11 KiB) Viewed 4241 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Unable to set a temporary attribute

Post by tomfid »

Is it a key? You can't change a key.
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: Unable to set a temporary attribute

Post by Jack Harich »

No, and it refers to none. It is indeed a puzzle, a head scratcher, and an enigma! I also tried setting it with a shadow variable.
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: Unable to set a temporary attribute

Post by Jack Harich »

We have a clue. See the table for Media Meme. Action G5_2 Create News Org MMs calls action G5_3 Create News Org MMs for One Politician, which adds five records to Media Meme, all for the same politician. Only the first has Politician set. The rest are empty. Is it possible that Ventity is somehow losing the value of temp PoliticianID after the first of five calls?
PostResultsTableMediaMeme_Every fifth Politician is set.png
PostResultsTableMediaMeme_Every fifth Politician is set.png (53.96 KiB) Viewed 4235 times
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: Unable to set a temporary attribute

Post by Jack Harich »

A small question. What is the logical operator for "or"? The one for and is "&&".
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Unable to set a temporary attribute

Post by tomfid »

or = ||

Generally boolean syntax is c-like: &&, II, !=, == but we permit a single = and <> too.
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Unable to set a temporary attribute

Post by tomfid »

Problem could be that you're using surrogates where you need references. Rule of thumb should be, if you're not changing an attribute, use a reference. Easiest way to change it is to edit the downstream equation, change the bullet to a dot, then use the right click method to add the referenced var, and delete the surrogate from the model.
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Unable to set a temporary attribute

Post by tomfid »

Another thing I notice is that there's an undeleted parent surrogate that's not on the diagram (probably inadvertent use of delete key).
rdem97.png
rdem97.png (131.5 KiB) Viewed 4195 times
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: Unable to set a temporary attribute

Post by Jack Harich »

Thanks once again. I appreciate your style, showing and explaining the problems you find, rather than solving the problem. That maximizes learning!

I noticed you had shadow variables and my version of the model didn't. First I deleted two undeleted items. This made almost no difference, still got about 170 warnings. Then I started changing attributes to shadows. On G5_3 Create News Org MMs for One Politician, changing Invoker (large dot) temp politicianID to little dot with a shadow eliminated all warnings. Wow.

If use of a non-shadow causes the framework to misbehave, it seems to me it would be extremely helpful to say so in the warnings. Instead, all it says is "Unable to reference Entity Type [politician] from belief_meme [belief_meme[belief_meme_0108]] using Attribute [Politician]". This problem happens much later than what this action is doing. Thanks!
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Unable to set a temporary attribute

Post by tomfid »

I'm not sure if the change in notation is causing fewer warnings because of some property of surrogate vs. reference, or because the result is fewer undefined reference attributes around, but I'll look into it.

I think the underlying problem is that the interface steers you to use of surrogates where references would be more appropriate. I've ticketed this for an improvement.
Post Reply