Error en Selector cambia Descripción por Valor en la Tabla
Good morning, we are developing a capture in "Form View", I include the image,
In the "Marca" column we must select an element by name and take its key to place it in the corresponding table. It presents us with 2 problems, the first is that it does not convert long names to its key, it gives us an error that the field is longer than what is defined in the table and it assigns a different key to it; the second problem is that the fields that have an "&" in the name, it removes the ampersan and puts the text in place of the key. I am attaching the DAC code.
    #region Marca     public abstract class marca : PX.Data.IBqlField { }
    ÂPXDBString(20, IsUnicode = true, IsKey = true)]     rPXDefault()]
    ]PXSelector(typeof(Search<CSAttributeDetail.valueID,        Where<CSAttributeDetail.attributeID, Equal<attributeLaboratorio>,          And<CSAttributeDetail.disabled, NotEqual<True>>>>),        typeof(CSAttributeDetail.valueID),        typeof(CSAttributeDetail.description),        typeof(CSAttributeDetail.disabled),        SubstituteKey = typeof(CSAttributeDetail.description))]
    iPXUIField(DisplayName = "Marca", Visible = true)]     public string Marca { get; set; }     #endregion Marca
In summary the "ValueID" is replaced by the "SubstituteKey-Description" in the table (next image).
Page 1 / 1
Hi @arturoromo51,
Could you please clarify below point?
why do you want to make the Marca field as Primary Key field in that grid.
Â
Good morning, the "Marca" field is not the primary key, it is made up of all the previous fields plus the "Brand" and is a Selector. We have already solved the problem of the correct registration of the "Marca", it gives us the correct password, we only have to know with which instruction we prevent it from removing the "&" symbols contained in the description. The code in the DAC was as follows:
    #region Marca     public abstract class marca : PX.Data.IBqlField { }
    ÂPXDBString(60, IsUnicode = true, IsKey = true)]     rPXDefault()]     )PXUIField(DisplayName = "Marca", Visible = true)]
    rPXSelector(typeof(Search<CSAttributeDetail.valueID,        Where<CSAttributeDetail.attributeID, Equal<attributeLaboratorio>,          And<CSAttributeDetail.disabled, NotEqual<True>>>>),        typeof(CSAttributeDetail.valueID),        typeof(CSAttributeDetail.description),        typeof(CSAttributeDetail.disabled),        SubstituteKey = typeof(CSAttributeDetail.description),        DescriptionField = typeof(CSAttributeDetail.valueID))]
    public string Marca { get; set; }     #endregion Marca Â
Â
I just verified with this selector and observed it is working for me. Please find the screenshots for reference. I’m NOT sure why it is not showing for you.
Â
Â
Â
Thank you very much Naveen B, we solved the problem, we added one more column and in one we put the key and in the other the description, as shown on the screen.
The code is the following:
    #region Marca     public abstract class marca : PX.Data.IBqlField { }
    ÂPXDBString(10, IsUnicode = true, IsKey = true)]     rPXDefault()]     )PXUIField(DisplayName = "Marca", Visible = true)]
    rPXSelector(typeof(Search<CSAttributeDetail.valueID,        Where<CSAttributeDetail.attributeID, Equal<attributeLaboratorio>,          And<CSAttributeDetail.disabled, NotEqual<True>>>>),        typeof(CSAttributeDetail.valueID),        typeof(CSAttributeDetail.description),        typeof(CSAttributeDetail.disabled),        SubstituteKey = typeof(CSAttributeDetail.valueID),        DescriptionField = typeof(CSAttributeDetail.description))]
    public string Marca { get; set; }     #endregion Marca
    #region MarcaDesc     public abstract class marcaDesc : PX.Data.IBqlField { }
    // Acuminator disable once PX1030 PXDefaultIncorrectUse XJustification]     PXDBString(60, IsUnicode = true)]     fPXUIField(DisplayName = "Marca Descrip.", Visible = true, Enabled = false)]
    ÂPXFormula(typeof(Selector<marca, CSAttributeDetail.description>))]     public string MarcaDesc { get; set; }     #endregion MarcaDesc