C1CalcEngine vs C1ExpressionEditor

Posted by: gkayne on 17 September 2020, 6:13 pm EST

  • Posted 17 September 2020, 6:13 pm EST

    I have a typed list as a data source - can anyone help me understand the following inconsistencies:

    1) When is use the C1ExpressionEditor visually it recognizes all the property descriptor fields without issue using:
    - Direct properties work using the property name
    - Child properties work using the property name - you do not have to qualify the path (ie.ChildClassName.PropertyName)
    - Custom Properties added with delegates work using the added property name

    2) When using the C1CalcEngine against this source:
    - Direct properties work using the property name
    - Child properties do not work using the property name - you have to qualify the path (ie.ChildClassName.PropertyName))
    - Custom Properties added with delegates are note recognized

    3) When I replace the C1CalcEngine object with a C1ExpressionEditor and use it in code (it is not displayed) – I run into the same issues as (2) above using the C1CalcEngine.

    I am trying to add a custom field to my typed list which assigns a delegate to a function that uses the C1CalcEngine to evaluate the formula entered by the user. It works with the restrictions shown in bullet 2 above.

    Is there a way to have the C1CalEngine work with field names in the same way the C1ExpressionEditor does when displayed?

    Why does C1ExpressionEditor evaluate fields differently when displayed vs using it in code without displaying it.
  • Replied 20 September 2020, 7:42 pm EST

    So after looking at this more closely, it appears the C1CalcEngine is reading the properties in the underlying data associated with TypedList and not the properties added to the TypeList's PropertyDescriptorCollection - so is ITypedList not supported by the C1CalcEngine.
  • Replied 22 September 2020, 6:06 am EST

    Hello Glen,

    Would it be possible to share a stripped down application? It would help us in effectively investigating the concern.

    With thanks,

  • Replied 22 September 2020, 6:44 am EST

    I'll put an example together - but essentially it comes down to using a typed list as the datasource for the C1CalcEngine. It does not recognize the fields defined in the PropertyDescriptorCollection - it exposes the Public Properties of the underlying Type - which is not desired.

    If you use the same Typed List for the C1ExpressionEditor and display it, it recognizes and exposes the fields defined in the Type List's PropertyDescriptorCollection as desired.
  • Replied 22 September 2020, 8:00 pm EST

    A sample is attached . vbCalcEngineDemo.zip
  • Replied 23 September 2020, 4:29 am EST

    Thank you for the demo, Glen. I understood your concern and can observe the behavior like you mentioned.
    I am discussing it with dev [ID: 465261] and will get back to you as soon as there is an update.

    Regards,
  • Replied 12 October 2020, 8:47 pm EST

    Any update on this.
  • Replied 13 October 2020, 2:58 pm EST

    Hi,

    As per the latest information from team, C1CalcEngine uses C1DataCollcetion for work with data source and this library doesn't support ITypedList. So, its an enhancement request and they have it in their to-do list.
    To help you with a update, I have requested for an ETA and will update you as soon as I receive it.

    Regards,
  • Replied 13 October 2020, 7:16 pm EST

    Hi,

    The ETA of the feature is 2021v1 release.

    Thanks,
    Ruchir
  • Replied 22 October 2020, 7:06 am EST

    Hi,

    The team has confirmed about the current limitation and is working over it.
    Meanwhile, as workaround you can add Nuget packages 'C1.DataCollection' (*.25 build) and 'C1.DataCollection.BindingList' (*.25 build). Then, change the data source of CalcEngine (AsDataCollection from C1.DataCollection.BindingList) in MyDataCollection class, as follows:
    Public Overridable ReadOnly Property CalcEngine As C1CalcEngine
    Get
    If _CalcEngine.DataSource Is Nothing Then
    _CalcEngine.DataSource = Me.AsDataCollection()
    '_CalcEngine.DataSource = LiveView
    End If
    Return _CalcEngine
    End Get
    End Property
    Also, the team wants to know whether do you plan to use CalcEngine .NET standard 2.0? Because the team can't add support to ITypedList in the 1.2 version.

    Regards,


  • Replied 27 October 2020, 7:55 pm EST

    Thanks for the reply - I'll try it out - I have a current work around where I pass a delegate to a C1ExpressionEditor and use it to evaluate the expression when the grid is displayed - but it is not a preferred solution.

    If by using CalcEngine.NET standard 2.0 you mean the next version to be released in the 2021v1 release, then yes. Can you please confirm this version is not currently available.
  • Replied 29 October 2020, 1:10 am EST

    Thank you for sharing the workaround you are using.

    >If by using CalcEngine.NET standard 2.0 you mean the next version to be released in the 2021v1 release, then yes. Can you please confirm this version is not currently available.
    Yes, thank you for confirming. Also, yes, the version is not yet available.

    Regards,
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels