Current filter:
                                You should refresh the page.
                                  • Hello,

                                    I'm using the Dashboard module with my XAF application.

                                    I have a dashboard with two datasources (XPO) :
                                     -  The first is the XPO class "Prime assurance OFSP" which contains a reference property "Region Prime" which contains a nesteded collection of "Lieux"
                                     -  The second is XPO object of type "Lieux"

                                    The second datasource is the datasource of my dynamic list parater.

                                    When the user select the "Lieux" from the parameter, how can filter my first datasource with that data.
                                    Please see attachment for the details.

                                    I hope that my explanation is clear enough and that you can help.

                                    Many thanks in advance.

                                    BR
                                    ISA

                                • Andrey K (DevExpress Support) 09.10.2019

                                  Hello,
                                  I am passing this question to our Dashboards team for further research as it seems to be related to the Dashboard control's engine. Please await their answer.
                                  As far as XAF is concerned, you can access the Dashboard control within an XAF application as described at How to: Access the Dashboard Control.  Let me know if you experience any further difficulties with the XAF integration.
                                  Thanks,
                                  Andrey

                                1 Solution

                                Creation Date Importance Sort by

                                Hi Isa,

                                The Dashboard Suite does not provide built-in functionality to filter properties with nested collections. As a possible solution, you can create a custom filter function that accepts two parameters (a property with a collection and a city parameter value) and returns true or false depending on whether the collection contains the city.

                                You will be able to use this function in our Filter Editor to define the filter. To learn how to create custom functions, refer to the Custom Functions article.

                                Show all comments
                                • Isa_Tahiri 09.11.2019

                                  Hi Sergi,

                                  Before i get to a Custom function, i would like to see if there something to do with this second approach.
                                  Sorry I just start with Dashboard Suite and i'm not very comfortable yet.

                                  Many thanks for your help.
                                  BR
                                  ISA

                                • Isa_Tahiri 09.11.2019

                                  I seems that i forgot the attachment. Sorry

                                • Isa_Tahiri 09.11.2019

                                  Hi,

                                  I made it work with the custom function. But not with contains. I created a custom function giving the Region Oid from a Lieux Oid. (Second approach)
                                  I'm still interested if there is a standard way.

                                  But i do not uderstand what is the difference between ICustomFunctionOperatorFormattable.Format and ICustomFunctionOperator.Evaluate. In my case the format would have been enough right ?

                                  Did I use in my function the   ICustomFunctionOperatorFormattable.Format and  ICustomFunctionOperator.Evaluate correctly ?
                                  Many thanks for your help !

                                  ISA

                                  My function :
                                   public class PME_ResidenceExsitsInRegionFunction : ICustomFunctionOperatorFormattable
                                      {
                                          #region ICustomFunctionOperatorFormattable Members
                                          string ICustomFunctionOperatorFormattable.Format(Type providerType, params string[] operands)
                                          {
                                              // This example implements the function for MS Access databases only.
                                              return string.Format("Select Region from PME_PremiumResidence where Oid = '{0}'", operands[0]);
                                          }

                                          public static string ResidenceExsitsInRegion(Guid residenceOid)
                                          {
                                              using (var uow = PME_ConnectionHelper.CreateObjectSpace())
                                              {
                                                  PME_PremiumResidence res = uow.GetObjectByKey<PME_PremiumResidence>(residenceOid);
                                                  if (res != null)
                                                      return res.Region.Oid.ToString();
                                                  else
                                                      return "";

                                              }
                                          }
                                          #endregion

                                          #region ICustomFunctionOperator Members
                                          // Evaluates the function on the client.
                                          object ICustomFunctionOperator.Evaluate(params object[] operands)
                                          {
                                              return ResidenceExsitsInRegion((Guid)operands[0]);
                                          }

                                          string ICustomFunctionOperator.Name
                                          {
                                              get { return "ResidenceExsitsInRegion"; }
                                          }

                                          Type ICustomFunctionOperator.ResultType(params Type[] operands)
                                          {
                                              return typeof(string);
                                          }
                                          #endregion
                                      }
                                  }

                                • Sergi (DevExpress Support) 09.12.2019

                                  Hi,

                                  It is not necessary to implement the ICustomFunctionOperatorFormattable interface because it should be used in server mode. Since Object Data Sources work in client mode, in your particular case, it is sufficient to implement the ICustomFunctionOperator interface.

                                • Isa_Tahiri 09.13.2019

                                  Hi,

                                  I did the custom function (see class below)
                                  In my custom function i'm searching string attribute of an object in the reference.
                                  I use this custom functin in a calculated field. (data source 1)
                                  The issue is that the custom function is evaluation in row of my data source (250k of rows) so i opens a session and does a getobjectById 250k times for getting always the same value. You can imagine how slow it can be.

                                  So it is clearly not a good option for me.

                                  Do you have any other suggestion to implement the approach described in this attachment ?

                                  Thanks for you help.

                                  public class PME_GetRegionCodeFromresidenceOid : ICustomFunctionOperator
                                      {
                                          public string Name
                                          {
                                              get
                                              {
                                                  return "PME_GetRegionCodeFromresidenceOid";
                                              }
                                          }
                                          public object Evaluate(params object[] operands)
                                          {
                                              using (var newSession = new Session())
                                              {
                                                  newSession.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                                                  newSession.Connect();

                                                  PME_PremiumResidence res = newSession.GetObjectByKey<PME_PremiumResidence>((Guid)operands[0]);
                                                  if (res != null)
                                                      return res.Region.Code;
                                                  else
                                                      return "";
                                              }
                                          }

                                          public Type ResultType(params Type[] operands)
                                          {
                                              return typeof(string);
                                          }
                                          static PME_GetRegionCodeFromresidenceOid()
                                          {
                                              PME_GetRegionCodeFromresidenceOid instance = new PME_GetRegionCodeFromresidenceOid();
                                              if (CriteriaOperator.GetCustomFunction(instance.Name) == null)
                                              {
                                                  CriteriaOperator.RegisterCustomFunction(instance);
                                              }
                                          }
                                          public static void Register()
                                          {
                                          }
                                      }

                                • Isa_Tahiri 09.13.2019

                                  I got it working with concatenation of data so i get the value i want in the parameter list.
                                  It is ugly but it works :-)

                                  BR
                                  ISA