Skip to main content
Answer

Modern UI

  • December 1, 2024
  • 4 replies
  • 103 views

Forum|alt.badge.img+1

When I add a field to the ts PXView I get the following error. 

Sequence contains more than one matching element

All other fields work as expected except the Template field. I am assuming it has something to do with the PXSelector but am not sure.

 

Below is the PXView def

@gridConfig({
preset: GridPreset.Details,
syncPosition: true
})
export class Inspections extends PXView {
CreateInspection: PXActionState;
DocDate: PXFieldState;
ProjectTask: PXFieldState;
InspectionCD: PXFieldState;
Template: PXFieldState;
}

 

 snippet from DAC defining template

       #region Template
        [PXDBInt]
        [PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
        [PXForeignReference(typeof(FK.Template))]
        [PXUIField(DisplayName = "Type", Visibility = PXUIVisibility.SelectorVisible, Required = true)]
        [PXSelector(
               typeof(Search2<GPProjectInspectionTemplate.templateID,
                   LeftJoin<GPProjectInspectionTemplateAssociations, On<GPProjectInspectionTemplateAssociations.FK.Template>,
                       LeftJoin<Contract, On<Contract.contractID, Equal<Current<project>>>,                           
                                LeftJoin<PMTask, On<PMTask.taskID, Equal<Current<projectTask>>>,
                                LeftJoin<GPEstimateTask, On<GPEstimateTask.taskCD, Equal<PMTask.taskCD>>>
                           >
                        >
                       >
                       ,
                   Where<
                       GPProjectInspectionTemplate.active, Equal<True>,
                           And<Where<GPProjectInspectionTemplate.restrictUseToAssociations, Equal<False>,
                             Or<Where<
                                Where<GPProjectInspectionTemplate.restrictUseToAssociations, Equal<True>,
                                And<Contract.templateID, Equal<GPProjectInspectionTemplateAssociations.projectTemplate>,
                                    And<GPProjectInspectionTemplateAssociations.taskID, IsNull,
                                        Or<GPEstimateTask.estimateTaskID, Equal<GPProjectInspectionTemplateAssociations.taskID>>>
                                    >>                                                          
                                >
                              >
                            >
                           >
                        >
                  ,
                   OrderBy<Desc<GPProjectInspectionTemplate.templateCD>>>),
                new Type[] {
                    typeof(GPProjectInspectionTemplate.templateCD),
                     ///typeof(GPProjectInspectionTemplate.crewType),
                     typeof(GPProjectInspectionTemplate.description)
    },
               SubstituteKey = typeof(GPProjectInspectionTemplate.templateCD),
               DescriptionField = typeof(GPProjectInspectionTemplate.description))]
        public virtual int? Template { get; set; }
        public abstract class template : PX.Data.BQL.BqlInt.Field<template> { }
        #endregion

 

Also the field works fine in the classic UI

Best answer by darylbowman

Then I think that indicates the problem. I would start with the most basic version of your selector that you can and progressively add complexity until you run into issues again.

4 replies

Forum|alt.badge.img+1
  • Jr Varsity III
  • December 2, 2024

Hi ​@Leif ,
   Change your DAC field Template name with other name. Same name may be already available.
 


darylbowman
Captain II
Forum|alt.badge.img+15
  • December 11, 2024

Have you tried commenting out the selector attribute in order to see if it is the selector it has a problem with?


Forum|alt.badge.img+1
  • Author
  • Varsity I
  • December 11, 2024

it shows a standard field when the selector is removed.


darylbowman
Captain II
Forum|alt.badge.img+15
  • Answer
  • December 12, 2024

Then I think that indicates the problem. I would start with the most basic version of your selector that you can and progressively add complexity until you run into issues again.