Dynamic dataview creation


 public static void AddViewToGraph(PXGraph graph, Type dacClass, Type dacClas2 = null)

        {

            var viewName = "_AppendGR" + graph.GetType().FullName + "_" + dacClass.FullName;

            if (!graph.Views.ContainsKey(viewName))

            {

                var command = BqlCommand.CreateInstance(typeof(Select<>), dacClass);

                var newView = new PXView(graph, true, command);

                graph.Views.Add(viewName, newView);

                graph.Views.Caches.Add(dacClass);


                if (dacClas2 != null)

                {

                    //command.WhereAnd<>

                }

            }

        } 




 public override void Initialize()

        {

            base.Initialize();

            AppendGraph.AddViewToGraph(Base, typeof(KNRWFileAttachmentsTran));

        }

Comments

Popular posts from this blog

grid row color and button color in acumatica