Solved

Show all records when Account Field is null in Account Details Screen

  • 28 July 2023
  • 6 replies
  • 112 views

Userlevel 4
Badge +1

Hi All,

 

I want to show all records associated with any Account when Account Filter field is null in Account Details Screen. Otherwise it should work as usual. How can I achieve this?

 

Thanks

icon

Best answer by davidnavasardyan09 21 August 2023, 08:15

View original

6 replies

Userlevel 4
Badge +1

Hi @Naveen Boga, Any idea on this? 

Badge +18

Hello,

Here is a post on how to re-create the Account Details screen without the required Account Number parameter, answered by Benjamin C of Acumatica:

Here is another post where Esteban P posts a GI, to help get you started.

Laura

Userlevel 7
Badge +17

Hi @charithalakshan49  I think that is possible by modifying the below VIEW Delegate by extending the AccountByPeriodEnq this graph.

 

    protected virtual IEnumerable glTranEnq()
        {
            return RetrieveGLTran();
        }

Userlevel 4
Badge +1

Hi @Naveen Boga Thanks for the idea. However, I have no idea how should I modify that view  as RetrieveGLTran() returns records that are already filtered by Account ID.

Userlevel 4
Badge +1

@Naveen Boga Could you help me?

Userlevel 5
Badge +1

Hi @charithalakshan49 .

To achieve this functionality, you can modify the BQL Select statement of the view associated with the Account Details grid in the graph extension. You can use the Where method and If BQL statement to handle the case when the Account Filter field is null and when it is not. Below is an example of how you can achieve this:

Assuming you have a DAC called AccountDetail and the graph associated with the Account Details Screen is AccountDetailsGraph. Also, let's assume that the AccountFilter field is part of a DAC called AccountFilter.

Here's how you can create a graph extension to modify the behavior of the view:

 

public class AccountDetailsGraph_Extension : PXGraphExtension<AccountDetailsGraph>
{
// Assuming your original view is called AccountDetails
public PXSelect<AccountDetail,
Where2<Where<AccountFilter.accountID, IsNull,
Or<AccountDetail.accountID, Equal<Current<AccountFilter.accountID>>>>,
And<... /* other conditions here */>>> AccountDetails;

protected virtual void _(Events.RowSelected<AccountFilter> e)
{
if (e.Row == null) return;

AccountDetails.View.WhereAnd<Where<AccountDetail.accountID, Equal<Current<AccountFilter.accountID>>>>();
if (e.Row.AccountID == null)
{
AccountDetails.View.WhereOr<Where<AccountDetail.accountID, IsNotNull>>();
}
}
}

In the code above, we're extending the AccountDetailsGraph and modifying the AccountDetails view's BQL statement. In the RowSelected event of the AccountFilter DAC, we're checking if the AccountID is null. If it is, we modify the view to show all records where AccountID is not null. Otherwise, it will only show records associated with the selected Account ID.

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 — 2024  Acumatica, Inc. All rights reserved