Skip to main content

Hi,

  i have added a Custom UDF for SOLine on Sales order screen, everything works fine, but when i apply a filter to that feild it doesnot work, any help will be greatly appriciated

thank you

Could you provide more details of the method you are using for filtering?  If possible share some screenshots.  Thank you


I have a customization that uses the SO Line row selected event, which calculates the sales markup percentage of a SO Line: (Line Amount-(average cost*order qty)/(average cost*order qty)), it then takes this value and sets it a custom field that I have placed in the Details grid of the sales order. There is also some logic to highlight the row red depending on the results of that calculation and an attribute on the inventory item. This works correctly BUT the problem is that we cant sort or filter the grid on this field. I understand that this is because this value is not actually present in the database, according to my research the value has to be present in the database to be able to sort/filter on it.

 

 how can I modify this to make it so the calculation is persisted to the database so that we can sort/filter the grid based on the value of the calculation. the below is my code

Thanks in Advance

 

when i filter the value like below it does not work

 

                 
When i sort the value it doesnot work

 


First off, the code you have is running BQL queries in RowSelected, which is not best practice. In the future, you should use FieldSelecting to populate unbound fields, but we're getting away from that.

Since your calculations depend on both CuryLineAmt and OrderQty, you'll want to rerun the calculation any time either of those fields changes. To accomplish this, you can put the calculation in it's own method and call it from FieldUpdated for both fields.

The code you have is already setting the value in the field, so I think that should do it. Just move it from RowSelecting into a method instead and call it whenever you need it updated.

You'll need to change the DAC extension definition to a PXDBDecimal and add the field to the SOLine table. I'm assuming you know how to do this.


@Atiq - Did you get this figured out?


Thank you @darylbowman , and Soory for the delayed reponse yes it worked, I Have applied PXFormula() for the calculations 


Reply