How scxml transition target works - scxml

I am trying to understand scxml transition target state set. Here is some of my example code:
<parallel id="p">
<state id="A" initial="A1">
<state id="A1">
<transition event="test" target="B2" />
</state>
<state id="A2" />
</state>
<state id="B" initial="B1">
<state id="B1" />
<state id="B2" />
</state>
<state id="C" initial="C1">
<state id="C1" />
<state id="C2" />
</state>
</parallel>
if P, A, A1, B, B1, C and C2 are currently active. Now event "test" is coming, so the transition will take place to target state "b2"
1) Base on section 3.13 of State Chart XML (SCXML): State Machine Notation for Control Abstraction, the ancestors state A, and P will be affected. Al states will be exited then re-enter P, or only A1 and A are exited?
2) if all states are exited and re-enter at P then set P, A, A1, B, B2, C and C1 are active or set P, A, A1, B, B2, C and C2 are active? (because c2 was active before transition "test" took place)

The exit set consists of all active states that are proper descendants of the LCCA of the source and target states. This means that all states will be exited, including P since LCCA must be a , not a
The entry set consists of all members of the transition's complete target set that will not be active once the states in the exit set have been exited.
Since there is no active states after exit, the entry set is B2, specfied in the transition's target, and the two default states A1 and C1. There is no 'memory' regarding which states were active before exit.
So "P, A, A1, B, B2, C and C1" is the correct answer

Related

How to etree findall() on many levels

I try to manipulate an diagrams.net (formerly draw.io) not compressed XML exported drawing.
Cables can be hooked up to elements and I want to get a cables-list.
I do a search for all cables by testing if the element has source and target attributes. Then I compare the id's of both with the full list of elements to find the connected label in value.
That works great until someone tries to add an "addon-tag". After that (even if it's deleted), the element gets wrapped in a <object> that has the id attribute but the source and target attribute stay in a child node called like this:
before:
<mxCell id="ferXMembXyNwfAPwV5vA-22" value="" style="..endless list" edge="1" parent="1" source="ferXMembXyNwfAPwV5vA-8" target="ferXMembXyNwfAPwV5vA-18">
<mxGeometry relative="1" as="geometry">
<mxPoint x="540" y="520" as="sourcePoint" />
<mxPoint x="700" y="520" as="targetPoint" />
</mxGeometry>
</mxCell>
after:
<object label="" id="ferXMembXyNwfAPwV5vA-53">
<mxCell style="..endless long list" edge="1" parent="1" source="ferXMembXyNwfAPwV5vA-42" target="ferXMembXyNwfAPwV5vA-51">
<mxGeometry relative="1" as="geometry">
<mxPoint x="660" y="340" as="sourcePoint" />
<mxPoint x="770" y="360" as="targetPoint" />
</mxGeometry>
</mxCell>
</object>
this findall works for normal mxCell formated to find id, source and target elements:
list_of_mxCell_elements = root.findall(root_node,".//*[#source][#target]")
and this for objects elements id's:
list_of_objects_elements = root.findall(root_node,".//*[#source][#target]/..")
But how can I access the mxCell element from the list_of_objects_elements, so I can get hold of source and target id's?
I found a solution by my own.
After findall 'elements' i iterate over the list of elements and just do another findall on each cable element i got.
It looks somewhat like this:
list_of_objects_elements = root.findall(root_node,'.//*[#source][#target]/..')
for cable in list_of_objects_elements:
for mxCell in cable.findall('./*[#source][#target]'):
Note the slighly different findall path:
This makes an search for source & target in <mxCells> while passing back the next higher element <object> from root.
.//*[#source][#target]/..
./*[#source][#target]
While the lower searches for source & target in only one element deeper than <object>
To me those paths are still a Mindblow.

SCXML notation of a target set

How can I define a "legal state configuration" according to https://www.w3.org/TR/scxml/#LegalStateConfigurations. I want to specify a target set (!), not a single target. Target sets can be defined inside the initial attribute of the <scxml> and <state> elements, as well as a target attribute of <transition> elements. But I can't seem to find any example of the notation of more than one state inside the above-mentioned attributes. Do they have to be space-separated? Or array notation according to JavaScript? Or object notation? Or comma-separated?
Thanks for any hints.
But anyway I'd like to know, what I have missed in the standard, to be sure to be interpreter-independent.
Here's a little testcode:
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0">
<initial>
<transition target="State_3_2 State_4_2" />
</initial>
<parallel id="Parallel_1">
<history id="hist" type="deep">
<transition target="State_1_2 State_2_2" />
</history>
<state id="State_1">
<state id="State_1_1" />
<state id="State_1_2" />
</state>
<state id="State_2">
<state id="State_2_1" />
<state id="State_2_2" />
</state>
</parallel>
<parallel id="Parallel_2">
<transition target="hist" event="switch_hist" />
<state id="State_3">
<state id="State_3_1" />
<state id="State_3_2" />
</state>
<state id="State_4">
<state id="State_4_1" />
<state id="State_4_2" />
</state>
</parallel>
</scxml>
To test: on entry, the states State_3_2 and State_4_2 must be active (initial element executed correctly), after event switch_hist, states State_1_2 and State_2_2 must be active (transitionattribute executed correctly).
If somebody has an interpreter all set other than SCION, could You test this there?
Also the alternative syntax with the first 4 lines replaced by
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initial="State_3_2 State_4_2">
Thank You.
It is space-separated. You can see an example of this in the SCXML test test suite. For example line 9 of test364.
Hope this helps. Thanks.

Routing to a different channels based on condition

I would like to route the message to different channels based on the condition of the property.
Let's say I have score property. If the score is <100 then it goes to "perfectchannel" else it goes to "normalchannel"
Where do I specify the spel expression or condition
<si:router id="serviceRouter" input-channel="serviceRoutingChannel"
expression="payload.score" default-output-channel="badchannel"
resolution-required="false">
<si:mapping value="100" channel="perfectchannel" />
<si:mapping value="<100 ??" channel="normalchannel" />
</si:router>
Appreciate your help on this.
We have a JIRA ticket on the matter, but haven't come up with the solution yet.
Right now you can achieve this behaviour with condition from the expression and providing mapping for true and false and with cascad of the routers:
<si:router id="serviceRouter" input-channel="serviceRoutingChannel"
expression="payload.score == 100">
<si:mapping value="true" channel="perfectChannel" />
<si:mapping value="false" channel="nestedRouterChannel" />
</si:router>
<si:router input-channel="nestedRouterChannel"
expression="payload.score lt 100">
<si:mapping value="true" channel="normalChannel" />
<si:mapping value="false" channel="badChannel" />
</si:router>
UPDATE
Another option to use <recipient-list-router>:
<recipient-list-router id="serviceRouter" input-channel="serviceRoutingChannel">
<recipient selector-expression="payload.score == 100" channel="perfectchannel"/>
<recipient selector-expression="payload.score lt 100" channel="normalchannel"/>
<recipient selector-expression="payload.score gt 100" channel="badchannel"/>
</recipient-list-router>

Ext:BooleanColumn,when editing ,it shows true or false value

I have a grid and there is ext:BooleanColumn inside it,and I put a combobox for editing boolen colum.everything works fine ,except of this one .when I click boolen colum to edit,it shows false or true inside it,
I added a image what I trying to say.
how I can avoid this .thank you
and here is the my code :
<ext:BooleanColumn ID="BooleanColumn1" runat="server" DataIndex="BorcOdendimi" TrueText="odendi" Text="ödenme durumu"
FalseText="odenmedi" >
<Editor>
<ext:ComboBox runat="server" Text="odendi durumu" Editable="false">
<Items>
<ext:ListItem Text="Odendi" Value="1" />
<ext:ListItem Text="Odenmedi" Value="0" />
</Items>
</ext:ComboBox>
</Editor>
</ext:BooleanColumn>
To get it working the Values of the ComboBox's Items should match the values of a BooleanColumn. Currently, true/false (BooleanColumn's values) doesn't match 1/0 (ComboBox Items' values).
You can replace the existing ComboBox's Items with:
<ext:ListItem Text="Odendi" Value="true" Mode="Raw" />
<ext:ListItem Text="Odenmedi" Value="false" Mode="Raw" />
Answered in the Ext.NET forums thread.

Combining attribute groupings on Dynamics CRM 2011 Charts

If I have a list of appointments w/ status codes I want to create a pie chart of, is there a way to combine some of the status codes to make the chart more readable:
Example: I have status codes A1, A2, A3, A4, B1, B2, B3, B4, C1, C2, C3, C4. Is there a way via FetchXML that I can create groupings of all the A, all the B, and all the C status codes so the pie chart only has 3 sections?
Here is the existing code:
<visualization>
<visualizationid>{F312E947-987E-E111-8116-00155D825C08}</visualizationid>
<name>This Week's Status Codes</name>
<primaryentitytypecode>serviceappointment</primaryentitytypecode>
<datadescription>
<datadefinition>
<fetchcollection>
<fetch mapping="logical" aggregate="true">
<entity name="serviceappointment">
<attribute groupby="true" alias="_CRMAutoGen_groupby_column_Num_0" name="statuscode" />
<attribute alias="_CRMAutoGen_aggregate_column_Num_0" name="statuscode" aggregate="count" />
</entity>
</fetch>
</fetchcollection>
<categorycollection>
<category alias="_CRMAutoGen_groupby_column_Num_0">
<measurecollection>
<measure alias="_CRMAutoGen_aggregate_column_Num_0" />
</measurecollection>
</category>
</categorycollection>
</datadefinition>
</datadescription>
<presentationdescription>
<Chart Palette="None" PaletteCustomColors="55,118,193; 197,56,52; 149,189,66; 117,82,160; 49,171,204; 255,136,35; 97,142,206; 209,98,96; 168,203,104; 142,116,178; 93,186,215; 255,155,83">
<Series>
<Series ShadowOffset="0" IsValueShownAsLabel="True" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PieLabelStyle=Inside, PieDrawingStyle=Default" ChartType="pie">
<SmartLabelStyle Enabled="True" />
</Series>
</Series>
<ChartAreas>
<ChartArea>
<Area3DStyle Enable3D="false" />
</ChartArea>
</ChartAreas>
<Legends>
<Legend Alignment="Center" LegendStyle="Table" Docking="right" IsEquallySpacedItems="True" Font="{0}, 11px" ShadowColor="0, 0, 0, 0" ForeColor="59, 59, 59" />
</Legends>
<Titles>
<Title Alignment="TopLeft" DockingOffset="-3" Font="{0}, 13px" ForeColor="0, 0, 0"></Title>
</Titles>
</Chart>
</presentationdescription>
<isdefault>false</isdefault>
</visualization>
You can't aggregate separate types in charts. Instead, create a separate field for this and map the data over properly. An on-demand workflow can accomplish this data migration task pretty easily.

Resources