Strange behavior of Custom C1 tree or even c1 bug

Topics: Troubleshooting
May 16, 2011 at 9:20 AM
Edited May 16, 2011 at 9:36 AM

Hi All,


I am working on booking system  where each booking has "BookingDate" and "Status" fields. I have built my custom C1 tree and it looks great. But unfortunately when I signed out from c1 console  my "Tree application" stoped to work.


On the image below you can see I have 3 levels of grouping by "BookingDate" (Year, Month, Day).
If I remove the "Month", "Day" levels my " tree application" works again.

 

P.S I still can have 3 levels(on the fly update xml) and it will work until first "Tools-->Server Restart" ot Sign out


Can someone please check my xml ?

 

<ElementStructure xmlns="http://www.composite.net/ns/management/trees/treemarkup/1.0" xmlns:f="http://www.composite.net/ns/function/1.0"> 
  <!-- tree definition  -->
  <ElementStructure.AutoAttachments>
    <NamedParent Name="Content" Position="Bottom"/>
  </ElementStructure.AutoAttachments>
  
  <!-- elements of the tree structure --> 
  <ElementRoot> 
	<Children>
      <Element Label="Booking system" Id="BookingRoot">
		<Actions>
			<AddDataAction Label="Add Booking" Type="DESCUBRE.Data.Booking"/>
		</Actions>
        <Children>			
			<DataElements Type="DESCUBRE.Data.BookingStatus"  Label="${C1:Data:DESCUBRE.Data.BookingStatus:Title}" Icon="Folder" Display="Auto">
						<Actions>
							<AddDataAction Label="Add Booking" Type="DESCUBRE.Data.Booking"/>
						</Actions>
						<Children>
							<DataFolderElements Type="DESCUBRE.Data.Booking" DateFormat="yyyy" FieldGroupingName="BookingDate"   Display="Auto">															
								<Actions>
									<AddDataAction Label="Add Booking" Type="DESCUBRE.Data.Booking"/>
								</Actions>
								<Children>
									<DataFolderElements DateFormat="MMMM" FieldGroupingName="BookingDate"   Display="Auto">															
										<Actions>
											<AddDataAction Label="Add Booking" Type="DESCUBRE.Data.Booking"/>
										</Actions>
										<Children>
											<DataFolderElements DateFormat="dddd dd" FieldGroupingName="BookingDate"   Display="Auto">															
												<Actions>
													<AddDataAction Label="Add Booking" Type="DESCUBRE.Data.Booking"/>
												</Actions>
												<Children>	
													<DataElements Type="DESCUBRE.Data.Booking" Label="${C1:Data:DESCUBRE.Data.Booking:FirstName} ${C1:Data:DESCUBRE.Data.Booking:LastName}, [Email-${C1:Data:DESCUBRE.Data.Booking:Email}], [Mob-${C1:Data:DESCUBRE.Data.Booking:Mobile}]" Display="Auto">														
																<Actions>
																	<EditDataAction Label="Edit Booking" />
																	<DeleteDataAction Label="Delete Booking" />
																	<AddDataAction Label="Add Passenger" Type="DESCUBRE.Data.Passenger"/>
																</Actions>
																<Filters>
																	<ParentIdFilter ParentType="DESCUBRE.Data.BookingStatus" ReferenceFieldName="Status" />															
																</Filters>
																<Children>
																	<Element Label="Passengers" Id="PassengersRoot">
																		<Actions>
																			<AddDataAction Label="Add Passenger" Type="DESCUBRE.Data.Passenger"/>
																		</Actions>
																		<Children>																			
																			<DataElements Type="DESCUBRE.Data.Passenger" Label="${C1:Data:DESCUBRE.Data.Passenger:Name} ${C1:Data:DESCUBRE.Data.Passenger:LastName}" Display="Compact">																				
																				<Actions>
																					<EditDataAction Label="Edit Passenger" />
																					<DeleteDataAction Label="Delete Passenger" />
																				</Actions>
																				<Filters>
																					<ParentIdFilter ParentType="DESCUBRE.Data.Booking" ReferenceFieldName="Booking" />
																				</Filters>											
																			</DataElements>
																		</Children>
																	</Element>
																</Children>
													</DataElements>
												</Children>			
											</DataFolderElements>		
										</Children>			
									</DataFolderElements>
								</Children>
							</DataFolderElements >
						</Children>
			</DataElements>
        </Children>
      </Element>      
    </Children>
  </ElementRoot>
</ElementStructure>

Additional infromation: 

C1 version : 

Composite C1 2.1.1
Build 2.1.4113.99
Error log :

 

System.NotImplementedException: Unsupported child entity token type 'Composite.C1Console.Trees.TreeDataFieldGroupingElementEntityToken'
   at Composite.C1Console.Trees.DataFolderElementsTreeNode.CreateFilterExpression(ParameterExpression parameterExpression, TreeNodeDynamicContext dynamicContext, IEnumerable`1 filtersToSkip)
   at Composite.C1Console.Trees.DataFilteringTreeNode.CreateAccumulatedFilterExpression(ParameterExpression parameterExpression, Type affectedInterfaceType, TreeNodeDynamicContext dynamicContext, IEnumerable`1 filtersToSkip)
   at Composite.C1Console.Trees.DataElementsTreeNode.CreateInnerExpression(TreeNodeDynamicContext dynamicContext, ParentIdFilterNode parentIdFilterNode, DataElementsTreeNode dataElementsTreeNode, Boolean includeJoin)
   at Composite.C1Console.Trees.DataElementsTreeNode.GetDatas(TreeNodeDynamicContext dynamicContext)
   at Composite.C1Console.Trees.DataElementsTreeNode.GetEntityTokens(EntityToken childEntityToken, TreeNodeDynamicContext dynamicContext)
   at Composite.C1Console.Trees.TreeAuxiliaryAncestorProvider.GetParents(IEnumerable`1 entityTokens)

Thanks!

 

May 18, 2011 at 7:03 AM

First of all, you tree seems to be ok!

I would like to reproduce this locally, there might be some strangeness going on here. So, can you zip your website and mail it to me: mrj AT composite DOT net. Or put it online and post the url here?

May 18, 2011 at 8:13 AM

Hi Martin,

Thanks for the reply. I will send you zip by email.

-Ruslan

May 25, 2011 at 7:43 AM

Hi Martin,

Have you received my email ? Is there any chance to get it working ?

Regards, Ruslan

May 25, 2011 at 11:10 AM

Hi Ruslan,

It seems to be related to the bug fixed in this change set: http://compositec1.codeplex.com/SourceControl/changeset/changes/7368. I have tested it locally end pretty sure its fixed in that change set.

Try to update to that change set (or newer) and see if it solves your problem.

/Martin

May 25, 2011 at 12:15 PM

Hi Martin,

it still doesn't work for me in change set 7368

P.S can't test it in the latest version as improvements in change set 7423  are not compatiable with my website.

 

-Ruslan

May 25, 2011 at 10:44 PM

@Ruslan, changeset 7368 does not have breaking changes compare to 2.1.1 (older 7423 has)

if your site is runnin' on 2.1.1, you can grab changeset http://compositec1.codeplex.com/SourceControl/changeset/view/7368, build Composite.dll & Composite.Workflows.dll and copy them to /bin folder, that should fix your problem 

May 26, 2011 at 8:12 AM
Edited May 26, 2011 at 8:16 AM

hi @naparnik,

my site is running under 2.1.1 but after the steps you have suggested I recieve an error "There is missing Composite.Core.Urls section" .

Please note I replaced web.config on one from 7423 change set but still the same error.

P.S My site can work with 7368 but my problem is not fixed in this change set

-Ruslan

May 27, 2011 at 10:30 AM

>> my site is running under 2.1.1 but after the steps you have suggested I recieve an error "There is missing Composite.Core.Urls section" .

I'm pretty sure you've downloaded sources from a newer checkin. In  7368 section "Composite.Core.Urls" isn't yet required.

If it doesn't help - that would be a question to @MartinJensen how to fix it

 

P.S. I misspelled in previous post 7424 is a newer, not older one :)

May 27, 2011 at 10:53 AM

yes , you are right -  it is a question to @MartinJensen :)

Regards, Ruslan

May 31, 2011 at 9:02 AM

Hi, please send me the site again. Ill try attaching the debugger :)

/Martin

May 31, 2011 at 9:23 AM

Hi :)

Done.

 

Thanks, Ruslan

May 31, 2011 at 9:52 AM
Edited May 31, 2011 at 9:53 AM

You are still using the releaed version of the site in the zipped version you mailed me. And not the changeset http://compositec1.codeplex.com/SourceControl/changeset/view/7368.

The bug you are experiencing should be fixed in that version.

So like napernik and I wrote earlier, you need to download the source code in changeset 7368).

Build it and use the result Composite.dll and Composite.Workflows.dll and put them in your website bin folder.

May 31, 2011 at 9:54 AM

i tested it in the version you both mentioned. It is not fixed. I must to proceed the developemnt and that's why I use last stable version

Aug 8, 2011 at 8:38 AM

Hi All,

 

Is it possible to create new perspective like "Content, Layout, etc" using xml markup for c1 applicatiops/trees ?

(it is mentioned here as scenario 3 http://docs.composite.net/C1/Console/Guide-to-Applications.aspx/An-Overview-of-Console-Applications but no instructions how achive that)

 

Thanks , Ruslan

Aug 8, 2011 at 8:43 AM
rvesyliv wrote:

Hi All,

 

Is it possible to create new perspective like "Content, Layout, etc" using xml markup for c1 applicatiops/trees ?

(it is mentioned here as scenario 3 http://docs.composite.net/C1/Console/Guide-to-Applications.aspx/An-Overview-of-Console-Applications but no instructions how achive that)

 

Thanks , Ruslan

Hello, Ruslan

Check this discussion - http://compositec1.codeplex.com/discussions/254598

Aug 9, 2011 at 6:10 PM

This may be a stupid question, but HOW did you get the full information from multiple fields to show up as the title showing in the tree? 

Aug 9, 2011 at 6:30 PM

You can set multiple field references in the label, like this

<DataElements Type="DESCUBRE.Data.Booking" Label="${C1:Data:DESCUBRE.Data.Booking:FirstName} ${C1:Data:DESCUBRE.Data.Booking:LastName}, [Email-${C1:Data:DESCUBRE.Data.Booking:Email}], [Mob-${C1:Data:DESCUBRE.Data.Booking:Mobile}]" Display="Auto">

Aug 9, 2011 at 6:50 PM
Edited Aug 9, 2011 at 6:53 PM

You don't!

A stupid workaround is to create a field on your type ONLY to hold this composite title field, and set it by subscribing to Add and Update event on your type in the datalayer.

A more correct proper way, is for CompositeC1 to include a MethodBasedTitleAttribute you can set on a IData interface. As it is now its a string that is referring to a valid property on the type, 
and if that property itself has a ForeignKeyAttribute, it will lookup the title of the referenced data instance.

This is all good, except for cases like your example - or one of mine, where i needed the title to be either Property1 or Property2 depending on which one had a value. With a MethodBased title, you could point C1
to a method of own choosing that takes a IData instance as input and returns a string, and that string is then used as title in the tree. 

UPDATE

Its true that for elements using TreeDefintions xml you can build up the label of different parts, but you can still not include any logic to ie. choose which property to use. For Page Datafolder elements, you're out of luck though,
since these elements are not defined in a TreeDefinition, and the only way would be to create your own ElementProvider.

Aug 23, 2011 at 12:14 PM
rvesyliv wrote:

Hi All,

 Is it possible to create new perspective like "Content, Layout, etc" using xml markup for c1 applicatiops/trees ?

(it is mentioned here as scenario 3 http://docs.composite.net/C1/Console/Guide-to-Applications.aspx/An-Overview-of-Console-Applications but no instructions how achive that)

 Thanks , Ruslan


Hi Ruslan,

FYI:

We have updated the documentation
and you can read on the topic you mentioned here:
How to Display Elements in Custom Perspectives

Thank you for pointing it out.

/Vitaly