Skip to main content
Solved

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

  • July 28, 2023
  • 6 replies
  • 341 views
  • Translate All

Forum|alt.badge.img+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

Best answer by dnavasardyan37

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.

View original

6 replies

Forum|alt.badge.img+1

Hi @Naveen Boga, Any idea on this? 

Translate

Laura03
Captain II
Forum|alt.badge.img+20
  • Captain II
  • July 28, 2023

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

Translate

Naveen Boga
Captain II
Forum|alt.badge.img+20

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

Translate

Forum|alt.badge.img+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.

Translate

Forum|alt.badge.img+1

@Naveen Boga Could you help me?

Translate

dnavasardyan37
Jr Varsity I
Forum|alt.badge.img+4

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.

Translate