Question

How to make sort descending by "prepare on" field of "customer statement history" on system default level?


Userlevel 6
Badge +5

Hello,

       Is it possible to sort by “prepared on” field by default on customer statement hisotry screen.
I know user can set it easily. But is it possbile to set by default?

        If we can acheive this without coding, it would be better.

 


8 replies

Userlevel 4
Badge +1

Hi @ray20,

 You can create a DataVeiw with OrderBy clause like the below :

 public SelectFrom<DAC>.
               Where<DAC.Field.
               IsEqual<DAC.Field.FromCurrent>>.
               OrderBy<Desc<DAC.Prepareon>>.View Test;

 

 

Thanks,

Moulali Shaik.

Userlevel 6
Badge +5

@MoulaliShaik79  Thank you for pointing out the right direction. However, my codes did not run successfully in 2021R2. Can you kindly point out where is wrong.
 

 

looks like the DAC is “DetailsResult”,  but if I put DetailsResult in codes, the codes can not be compiled.
I have to put “ARStatementForCustomer.DetailsResult” instead.

The whole code I am using is as below:

        public PXSelect<ARStatementForCustomer.DetailsResult,Where<ARStatementForCustomer.DetailsResult.branchID,
Equal<Current<ARStatementForCustomer.DetailsResult.branchID>>>,
OrderBy<Desc<ARStatementForCustomer.DetailsResult.preparedOn>>>Details;

 

The code can be compiled but it runs, the system throw out errors:

Object “DetailsResult” is invalid.

Please help.

 

Userlevel 6
Badge +5

I also tried

public PXSelectOrderBy<ARStatementForCustomer.DetailsResult,OrderBy<Desc<ARStatementForCustomer.DetailsResult.preparedOn>>> Details;

 same error

Userlevel 4
Badge +1

Hi @ray20,

 

Could you please try the below one:

  public SelectFrom<DetailsResult>.
            Where<DetailsResult.branchID.IsEqual<DetailsResult.branchID.FromCurrent>>.
            OrderBy<DetailsResult.preparedOn.Desc>.View Details;

 

 

Note: Import all the required libraries like:

          using PX.Data.BQL.Fluent;

 

 

Thanks,

Moulali Shaik.
         

Userlevel 6
Badge +5

@MoulaliShaik79 
Thank you for giving this details.

however, it compiled with error:
 

\App_RuntimeCode\ARStatementForCustomer.cs(22): error CS0246: The type or namespace name 'DetailsResult' could not be found (are you missing a using directive or an assembly reference?)

I can only use  “ARStatementForCustomer.DetailsResult” instead.

 

However, it also run with the same error

Object “DetailsResult” is invalid.

I think this is Acumatic DAC issue. 

Userlevel 4
Badge +1

Hi @ray20,

You need to import the “DetailsResult”  assembly reference to use in your code.

.

For Example,

  DetailsResult - DAC is available in some namespace like: PX.Data.Test

then you need to import the namespace like:

using PX.Data.Test;

FYI: To get the namespace name, open the required screen and do the following.

 

Hope this helps you.

 

Thanks,

Moulali Shaik.

 

 

Userlevel 6
Badge +5

@MoulaliShaik79  Thank you so much for all this help, for putting things in this kind of detail. You are so nice.
However, it looks like “AR404600” screen is a little kind of special.

The name spacename already exists in the extension file.

While if I put 

using PX.Objects.AR.ARStatementForCustomer;   // It does not pass compilation

using DetailsResult=PX.Objects.AR.ARStatementForCustomer.DetailsResult;  // this can pass

But still run with error.
I firstly tried your code and then mine, the same error.

 

If it is not too much to ask, can you try on your end on screen “customer statement history”.
Or never mind, we can skip this question. Just let the user to remember manually descending the field.
Thank you.

Userlevel 7
Badge

Hi @ray20 were you ever able to resolve your issue? Thank you!

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