Question

Need to Modify Query of a Projected DAC

  • 16 June 2023
  • 7 replies
  • 152 views

Userlevel 3
Badge

Hi,

I need to modify ARTranForDirectInvoice Project DAC.

Existing Query In DAC

[PXProjection(typeof(Select2<ARTran,
LeftJoin<INTran,
On<INTran.FK.ARTran>>,
Where<ARTran.released, Equal<boolTrue>,
And<
Where2<
Where<INTran.released, Equal<True>,
And<INTran.qty, Greater<decimal0>,
And<INTran.tranType, In3<INTranType.issue, INTranType.debitMemo, INTranType.invoice>>>>,
Or<
Where<INTran.released, IsNull,
And<ARTran.lineType, In3<SOLineType.miscCharge, SOLineType.nonInventory>,
And<
Where2<
Where<ARTran.qty, Greater<decimal0>,
And<ARTran.tranType, In3<ARDocType.debitMemo, ARDocType.cashSale, ARDocType.invoice>>>,
Or<
Where<ARTran.qty, Less<decimal0>,
And<ARTran.tranType, In3<ARDocType.creditMemo, ARDocType.cashReturn>>>>>>>>>>>>,
OrderBy<Desc<ARTran.refNbr>>>),
Persistent = false)]
[PXCacheName(AR.Messages.ARTran)]
[Serializable]

I need to remove And<INTran.qty, Greater<decimal0> condition from above query.

How I do that.


7 replies

Userlevel 7
Badge +17

Hi @jeewanishalika20  I have removed the below condition and please find the query below.

And<INTran.qty, Greater<decimal0> 


[PXProjection(typeof(Select2<ARTran,
LeftJoin<INTran,
On<INTran.FK.ARTran>>,
Where<ARTran.released, Equal<boolTrue>,
And<
Where2<
Where<INTran.released, Equal<True>,
//And<INTran.qty, Greater<decimal0>,
And<INTran.tranType, In3<INTranType.issue, INTranType.debitMemo, INTranType.invoice>>>,
Or<
Where<INTran.released, IsNull,
And<ARTran.lineType, In3<SOLineType.miscCharge, SOLineType.nonInventory>,
And<
Where2<
Where<ARTran.tranType, In3<ARDocType.debitMemo, ARDocType.cashSale, ARDocType.invoice>>,
Or<
Where<ARTran.qty, Less<decimal0>,
And<ARTran.tranType, In3<ARDocType.creditMemo, ARDocType.cashReturn>>>>>>>>>>>>,
OrderBy<Desc<ARTran.refNbr>>>),
Persistent = false)]

 

Userlevel 3
Badge

Hi @Naveen Boga ,

In this case I need to know Should I need to create a DAC extension from above DAC and need to add query mentioned by you.

Userlevel 7
Badge +17

Hi @jeewanishalika20  Sorry, I’m not clear with the above question. Can you please elaborate?

Userlevel 3
Badge

I need to Change query in ARTranForDirectInvoice DAC file.

I’m clear with how to modify it.But,I need to know How to add my modified query into DAC.

Can we change ARTranForDirectInvoice.cs file or need to create DAC extension to add the modified query.

Userlevel 7
Badge +17

No, we cannot change the ARTranForDirectInvoice.cs file, either you need to inherit or extend the DAC and check once.

Userlevel 3
Badge

@Naveen Boga ,

If I created a DAC extension and can I add the modified query into it.

Userlevel 7
Badge +8

@jeewanishalika20

sorry for typos. Writing on cellphone.


The projection DACs in Acumatica are equivalent of SQL views. I don’t think there is a way to alter built in Projections behavior. I am not sure about the extent of this projection DAC and its purpose of usage in your case but here are alternate options you have. Depending on your use case one or all my work. I ordered as easiest to most difficult below. please note the below option1 can work if inside the graph the view is not casted as the Projection DAC otherwise the platform will fail to explicitly convert one to another.

  1. copy the existing DAC and change the Projection query then in your graph extension override the view selecting from the original DAC to the Custom DAC
  2. wWrite a view delegate instructing the platform to read from custom DAC instead of original. If the view has already a delegate you will override the existing 
  3. A little bit of hacking by overriding the view in graph initialization and directing the existing view to read from a new one. The below is an example for a different scenario but logic is the same. See Yuriy’s response also can be found in his blog.

 

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