Skip to main content
Answer

How to show additional column of PXDimensionSelector in Mobile App.

  • December 31, 2024
  • 3 replies
  • 79 views

Forum|alt.badge.img

On expense receipt screen we need customization.

We need to add Customer and Customer Name for mobile app.

(We can easily add Customer Name for web).

But for mobile app. How can we add additional field.

Original Acumatica Code:

[PXDBInt]
[PXUIField(DisplayName = "Project/Contract")]
[PXDimensionSelector(ContractAttribute.DimensionName,
typeof(Search2<Contract.contractID,
LeftJoin<EPEmployeeContract,
On<EPEmployeeContract.contractID, Equal<Contract.contractID>,
And<EPEmployeeContract.employeeID, Equal<Current2<employeeID>>>>>,
Where<Contract.isActive, Equal<True>,
And<Contract.isCompleted, Equal<False>,
And<Where<Contract.nonProject, Equal<True>,
Or2<Where<Contract.baseType, Equal<CTPRType.contract>,
And<FeatureInstalled<FeaturesSet.contractManagement>>>,
Or<Contract.baseType, Equal<CTPRType.project>,
And2<Where<Contract.visibleInEA, Equal<True>>,
And2<FeatureInstalled<FeaturesSet.projectModule>,
And2<Match<Current<AccessInfo.userName>>,
And<Where<Contract.restrictToEmployeeList, Equal<False>,
Or<EPEmployeeContract.employeeID, IsNotNull>>>>>>>>>>>>,
OrderBy<Desc<Contract.contractCD>>>),
typeof(Contract.contractCD),
typeof(Contract.contractCD),
typeof(Contract.description),
typeof(Contract.customerID),
typeof(Contract.status),
Filterable = true,
ValidComboRequired = true,
CacheGlobal = true,
DescriptionField = typeof(Contract.description))]
[ProjectDefault(BatchModule.EA, AccountType = typeof(expenseAccountID))]

Mobile app have only two fields.

Contract ID and Description. Even Customer field not available for mobile.

 

Best answer by bjani23

I tried and some code works fine.

To add Customer Name column in web. We need to replace attribute.

[PXDBInt]
[PXUIField(DisplayName = "Project/Contract")]
[PXDimensionSelector(ContractAttribute.DimensionName,
typeof(Search2<Contract.contractID,
LeftJoin<EPEmployeeContract,On<EPEmployeeContract.contractID, Equal<Contract.contractID>,And<EPEmployeeContract.employeeID, Equal<Current2<PX.Objects.EP.EPExpenseClaimDetails.employeeID>>>>,
LeftJoin<PMProject, On<PMProject.contractID, Equal<Contract.contractID>>>>,
Where<Contract.isActive, Equal<True>,
And<Contract.isCompleted, Equal<False>,
And<Where<Contract.nonProject, Equal<True>,
Or2<Where<Contract.baseType, Equal<CTPRType.contract>,
And<FeatureInstalled<FeaturesSet.contractManagement>>>,
Or<Contract.baseType, Equal<CTPRType.project>,
And2<Where<Contract.visibleInEA, Equal<True>>,
And2<FeatureInstalled<FeaturesSet.projectModule>,
And2<Match<Current<AccessInfo.userName>>,
And<Where<Contract.restrictToEmployeeList, Equal<False>,
Or<EPEmployeeContract.employeeID, IsNotNull>>>>>>>>>>>>,
OrderBy<Desc<Contract.contractCD>>>),
typeof(Contract.contractCD),
typeof(Contract.contractCD),
typeof(Contract.description),
typeof(Contract.customerID),
typeof(PMProject.customerID_Customer_acctName),
typeof(Contract.status),
Filterable = true,
ValidComboRequired = true,
CacheGlobal = false,
DescriptionField = typeof(Contract.description))]
[ProjectDefault(BatchModule.EA, AccountType = typeof(EPExpenseClaimDetails.expenseAccountID))]

To add Customer and Customer Name column in mobile

update screen EP301020 {
update container "ClaimDetails" {
update field "DetailsExpenseDetails#ProjectContract" {
pickerType = Searchable
selector {
add field "ContractID"
add field "Description"
add field "Customer"
add field "CustomerName"
}
}
}
}

 

3 replies

mariankharechko60
Jr Varsity I

You should check if those fields exists on DAC and that the screen use exactly the same DAC, if not you should add it:

public class EPExpenseClaimDetailsExt : PXCacheExtension<EPExpenseClaimDetails>
{
    #region CustomerID
    [PXDBInt]
    [PXUIField(DisplayName = "Customer")]
    [PXSelector(typeof(Search<BAccount.bAccountID>), 
                SubstituteKey = typeof(BAccount.acctName))]
    public virtual int? CustomerID { get; set; }
    public abstract class customerID : PX.Data.BQL.BqlInt.Field<customerID> { }
    #endregion

    #region CustomerName
    [PXString(255, IsUnicode = true)]
    [PXUIField(DisplayName = "Customer Name", Enabled = false)]
    public virtual string CustomerName { get; set; }
    public abstract class customerName : PX.Data.BQL.BqlString.Field<customerName> { }
    #endregion
}

and add to mobile:

{
    "screens": [
        {
            "id": "EP301010", 
            "name": "Expense Receipts", 
            "actions": [], 
            "containers": [
                {
                    "name": "Main",
                    "fields": [
                        { 
                            "name": "CustomerID", 
                            "displayName": "Customer" 
                        },
                        { 
                            "name": "CustomerName", 
                            "displayName": "Customer Name" 
                        }
                    ]
                }
            ]
        }
    ]
}
 


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • January 27, 2025

You should check if those fields exists on DAC and that the screen use exactly the same DAC, if not you should add it:

public class EPExpenseClaimDetailsExt : PXCacheExtension<EPExpenseClaimDetails>
{
    #region CustomerID
    [PXDBInt]
    [PXUIField(DisplayName = "Customer")]
    [PXSelector(typeof(Search<BAccount.bAccountID>), 
                SubstituteKey = typeof(BAccount.acctName))]
    public virtual int? CustomerID { get; set; }
    public abstract class customerID : PX.Data.BQL.BqlInt.Field<customerID> { }
    #endregion

    #region CustomerName
    [PXString(255, IsUnicode = true)]
    [PXUIField(DisplayName = "Customer Name", Enabled = false)]
    public virtual string CustomerName { get; set; }
    public abstract class customerName : PX.Data.BQL.BqlString.Field<customerName> { }
    #endregion
}

and add to mobile:

{
    "screens": [
        {
            "id": "EP301010", 
            "name": "Expense Receipts", 
            "actions": [], 
            "containers": [
                {
                    "name": "Main",
                    "fields": [
                        { 
                            "name": "CustomerID", 
                            "displayName": "Customer" 
                        },
                        { 
                            "name": "CustomerName", 
                            "displayName": "Customer Name" 
                        }
                    ]
                }
            ]
        }
    ]
}
 

I am not following Customer field is already present in popup in web but not in mobile application.

So, why should we need to add fields in “EPExpenseClaimDetails”? Additionally you suggested “PXDBInt”. So just for display do we need to add it in database?


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • Answer
  • February 21, 2025

I tried and some code works fine.

To add Customer Name column in web. We need to replace attribute.

[PXDBInt]
[PXUIField(DisplayName = "Project/Contract")]
[PXDimensionSelector(ContractAttribute.DimensionName,
typeof(Search2<Contract.contractID,
LeftJoin<EPEmployeeContract,On<EPEmployeeContract.contractID, Equal<Contract.contractID>,And<EPEmployeeContract.employeeID, Equal<Current2<PX.Objects.EP.EPExpenseClaimDetails.employeeID>>>>,
LeftJoin<PMProject, On<PMProject.contractID, Equal<Contract.contractID>>>>,
Where<Contract.isActive, Equal<True>,
And<Contract.isCompleted, Equal<False>,
And<Where<Contract.nonProject, Equal<True>,
Or2<Where<Contract.baseType, Equal<CTPRType.contract>,
And<FeatureInstalled<FeaturesSet.contractManagement>>>,
Or<Contract.baseType, Equal<CTPRType.project>,
And2<Where<Contract.visibleInEA, Equal<True>>,
And2<FeatureInstalled<FeaturesSet.projectModule>,
And2<Match<Current<AccessInfo.userName>>,
And<Where<Contract.restrictToEmployeeList, Equal<False>,
Or<EPEmployeeContract.employeeID, IsNotNull>>>>>>>>>>>>,
OrderBy<Desc<Contract.contractCD>>>),
typeof(Contract.contractCD),
typeof(Contract.contractCD),
typeof(Contract.description),
typeof(Contract.customerID),
typeof(PMProject.customerID_Customer_acctName),
typeof(Contract.status),
Filterable = true,
ValidComboRequired = true,
CacheGlobal = false,
DescriptionField = typeof(Contract.description))]
[ProjectDefault(BatchModule.EA, AccountType = typeof(EPExpenseClaimDetails.expenseAccountID))]

To add Customer and Customer Name column in mobile

update screen EP301020 {
update container "ClaimDetails" {
update field "DetailsExpenseDetails#ProjectContract" {
pickerType = Searchable
selector {
add field "ContractID"
add field "Description"
add field "Customer"
add field "CustomerName"
}
}
}
}