I'm just starting coding in Acumatica and I'm trying to add Sectors to the customer screen. I created a SQL Sector table (TRSector) with the 18 different sectors' names and codes. I also created another SQL table (TRCustSectorActive) that has all the combinations of customers' accounts and sector codes with additional information (is it active or not, dates, etc). The idea is that each customer will have information about each sector.
I'm trying to add a selector for the sectors on the customer page (AR303000). The problem I'm facing is that even though my selector is showing correctly if I try to change the sector, my selection automatically comes back to the first line. I'm guessing I'm doing something wrong when joining my two tables? Or should I have a CurrentSector view in my graph ?
Here are more details about my code. The selector in my TRCustSectorActive DAC looks like this :
#region SectorCD
[PXDBString(20, IsKey = true, IsFixed = true, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Filière")]
[PXSelector(
typeof(Search2<TRCustSectorActive.sectorCD, LeftJoin<TRSector, On<TRCustSectorActive.sectorCD, Equal<TRSector.sectorCD>>>, Where<TRCustSectorActive.bAccountID, Equal<Current<Customer.bAccountID>>>>),
typeof(TRCustSectorActive.sectorCD),
typeof(TRSector.name),
typeof(TRCustSectorActive.active)
)]
public virtual string SectorCD { get; set; }
public abstract class sectorCD : IBqlField { }
#endregion
I joined the TRSector DAC so that I can show the names of the sectors in the selection.
The view in the CustomerMaint extension looks like this :
public PXSelect<TRCustSectorActive, Where<TRCustSectorActive.bAccountID, Equal<Current<Customer.bAccountID>>>> Sector;
And in the page, I added this bit :
<px:PXFormView ID="DefFiliere" runat="server" Caption="Activation Filières" DataMember="Sector" RenderStyle="Fieldset" DataSourceID="ds" TabIndex="2100">
<Template>
<px:PXLayoutRule runat="server" ControlSize="SM" LabelsWidth="SM" StartColumn="True" />
<px:PXSelector runat="server" ID="edSector" DataField="SectorCD"/>
<px:PXLayoutRule runat="server" StartColumn="True" LabelsWidth="SM" ControlSize="SM" />
<px:PXCheckBox runat="server" ID="edActive" DataField="Active"/>
</Template>
</px:PXFormView>