ATVO by Appgineering
Download
Read-only

[Alpha 1.32.2.1] Custom Datasets are not overriding the base dataset functions

8 posts 4,802 views Started 29 Jul 2020, 21:05
Showing 1–8 of 8 posts
Robert O.
Original poster

Description: Custom Datasets are not overriding the base dataset functions

Steps to reproduce:

  1. Have a theme and attempt to create a Custom Dataset Script in C#
  2. Notice it gives an error noting that the protected overrides are not able to override due to the base function not being overrideable

Expected behaviour: The base DataSet functions should be overrideable

Nick Thissen Appgineering
Reply #1

Hi Robert. Did this start in the most latest alpha build? Did it work on the first release of this feature?
I may have broken it with the latest update and you may need to change your script. I think at least you need to replace any mention of "IEnumerable" with "IList".

Robert O.
Reply #2

Nick Thissen wrote:
Hi Robert. Did this start in the most latest alpha build? Did it work on the first release of this feature?
I may have broken it with the latest update and you may need to change your script. I think at least you need to replace any mention of "IEnumerable" with "IList".

Hi Nick,

It started in the latest Alpha Build. It worked fine on the first release of this feature. I'll look into it for you to see if a change to IList fixes the issue.

Robert O.
Reply #3
· edited

Upon further investigation - it seems that the reason for the issues present is due to the fact the classes no longer exist in the CustomStandingsDataSet class.

Previously on the initial implementation the two classes were the main ones being overriden:

FilterResults
OrderResults

When looking at how the base is overriden, could it be possible to override EntitySessionResultStandingsDataSet in a custom dataset implementation and then be able to give the same result?

  • Robert
Nick Thissen Appgineering
Reply #5

Changing all "IEnumerable" to "IList" seems to work for me. Did you try this? I should update the template, will do that for the next release.

using System;
using System.Linq;
using System.Collections.Generic;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
using ATVO.ThemeEditor.ThemeModels.DataSets;
using ATVO.ThemesSDK.Data.Results;
using ATVO.ThemesSDK.Ordering;

namespace Scripts
{
	public class Test : CustomStandingsDataSet
	{	
		protected override IList<IEntitySessionResult> FilterResults(
			ISimulation sim, 
			IList<IEntitySessionResult> results)
        {
        	// TODO: Filter results
        	return results;
        }
        
        protected override IList<IEntitySessionResult> OrderResults(
        	ISimulation sim, 
        	IList<IEntitySessionResult> results, 
        	IDataOrder order)
        {
        	// Optional: change the order of the results
        	
        	// Use the 'order' parameter to order by the selected Data Order 
        	// This is the default implementation; can leave this out
        	return order.Sort(results);
        }
        
        protected override ISessionResult GetSession(ISimulation sim)
        {
        	// Optional: change the session from which you want to pull the results
            return sim.Session.Current;
        }
	}
}
Robert O.
Reply #6

Nick Thissen wrote:
Changing all "IEnumerable" to "IList" seems to work for me. Did you try this? I should update the template, will do that for the next release.

using System;
using System.Linq;
using System.Collections.Generic;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
using ATVO.ThemeEditor.ThemeModels.DataSets;
using ATVO.ThemesSDK.Data.Results;
using ATVO.ThemesSDK.Ordering;

namespace Scripts
{
 public class Test : CustomStandingsDataSet
 { 
 protected override IList<IEntitySessionResult> FilterResults(
 ISimulation sim, 
 IList<IEntitySessionResult> results)
        {
        // TODO: Filter results
        return results;
        }
        
        protected override IList<IEntitySessionResult> OrderResults(
        ISimulation sim, 
        IList<IEntitySessionResult> results, 
        IDataOrder order)
        {
        // Optional: change the order of the results
        
        // Use the 'order' parameter to order by the selected Data Order 
        // This is the default implementation; can leave this out
        return order.Sort(results);
        }
        
        protected override ISessionResult GetSession(ISimulation sim)
        {
        // Optional: change the session from which you want to pull the results
            return sim.Session.Current;
        }
 }
}

This works fine. Will this be the definition of the base functions of the override going forward, or will we need to update it once it goes to Stable branch?

Nick Thissen Appgineering
Reply #7

The change was related to performance improvements. Since it's still in alpha it may change again, although I think it won't change much anymore. I'll try to keep it close to this and will update the templates when it goes to beta or stable.

Archive · Read-only

New replies have moved to Discord.