Skip to main content
Solved

Who to use PXSave with PXFilter


Forum|alt.badge.img
  • Jr Varsity III
  • 23 replies

My aim is to edit an entity which is selected by a Filter.

The Filter DAC contains only unbound fields and does not have a DB table. It is marked with [PXHidden]

In the graph there is the Filter, a View for the entity and the Save action:
 

public PXFilter<FilterDAC> Filter;

public SelectFrom<EntityDAC>.Where<EntityDAC.name.IsEqual<FilterDAC.name.FromCurrent>>>.View FilteredEntities;

public PXSave<FilterDAC>;

 

In the ASPX file I set Filter as PrimaryView of the DataSource and also as DataMember of the 1st form. A 2nd form with DataMember FilteredEntities to edit the entity.

The Filter works fine and I can edit the entity. The error occurs if I press the save button. PXGraph.ExecuteUpdate with viewName = ‘FilteredEntities” throws

Error: The table with the name 'FilterDAC' does not exist in the database.

That’s true, but shouldn’t this be ignored if the DAC has atribute PXHidden?

   [PXHidden]
    public class FilterDAC : IBqlTable
    {
        [PXString(IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "Name")]
        public virtual string Name { get; set; }
        public abstract class name : PX.Data.BQL.BqlString.Field<name> { }
    }

 

Best answer by Dmitrii Naumov

The [PXHidden] only hides the DAC from being visible on Generic Inquiries screen. 

What you are looking for is [PXVirtualDAC] attribute that you should put on the view 

https://help-2021r1.acumatica.com/(W(72))/Help?ScreenId=ShowWiki&pageid=53e457d2-a645-5098-1ea2-fe797bb116ce

View original
Did this topic help you find an answer to your question?

2 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3381 replies
  • May 27, 2021

Hi @mhaps ,

I have tried the same as above and I can able to Save the grid results in the database. NOT sure why you are getting that issue but below is the code, which I have tried for reference.

 

[Serializable]
    [PXHidden]
    public class TestEmployee : IBqlTable 
    { 
        #region Empid
        [PXInt()] 
        [PXUIField(DisplayName = "Employeee")]
        [PXSelector(typeof(Search<TestEmployeeDtls.empid>), typeof(TestEmployeeDtls.empName), SubstituteKey = typeof(TestEmployeeDtls.empName), DescriptionField = typeof(TestEmployeeDtls.empName))] 
        public virtual int? Empid { get; set; }
        public abstract class empid : PX.Data.BQL.BqlInt.Field<empid> { }
        #endregion
    } 

    [Serializable]
    public class TestEmployeeDtls : IBqlTable
    { 
        #region Empid
        [PXDBIdentity(IsKey = true)] 
        [PXUIField(DisplayName = "ID")]
        public virtual int? Empid { get; set; }
        public abstract class empid : PX.Data.BQL.BqlInt.Field<empid> { }
        #endregion 

        #region EmpName
        [PXDBString(30, IsUnicode = true )]
        [PXUIField(DisplayName = "Name")]
        public virtual String EmpName { get; set; }
        public abstract class empName : PX.Data.BQL.BqlString.Field<empName> { }
        #endregion

        #region Location
        [PXDBString(30, IsUnicode = true)]
        [PXUIField(DisplayName = "Location")]
        public virtual String Location { get; set; }
        public abstract class location : PX.Data.BQL.BqlString.Field<location> { }
        #endregion
    }
    public class Testmaint : PXGraph<Testmaint>
    {

        public PXFilter<TestEmployee> Test;  

        public SelectFrom<TestEmployeeDtls>.Where<TestEmployeeDtls.empid.IsEqual<TestEmployee.empid.FromCurrent>>.View TestEmployeeDtls;
 public PXSave<TestEmployee> Save;
    }

 

 


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+6
  • Acumatica Moderator
  • 595 replies
  • Answer
  • May 27, 2021

The [PXHidden] only hides the DAC from being visible on Generic Inquiries screen. 

What you are looking for is [PXVirtualDAC] attribute that you should put on the view 

https://help-2021r1.acumatica.com/(W(72))/Help?ScreenId=ShowWiki&pageid=53e457d2-a645-5098-1ea2-fe797bb116ce


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings