Question

Who to use PXSave with PXFilter


Badge

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> { }
}

 


2 replies

Userlevel 6
Badge +4

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;
}

 

 

Userlevel 1
Badge

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


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2020  Acumatica, Inc. All rights reserved