Calculate Field Get Sum - acumatica

Hi i'm having trouble finding the correct attribute syntax to calculate the total sum for an unbound field.
Could somebody point me into the right direction?
I have a custom DAC and a unbound field called Actual
Also in my DAC is employeeid, projectid and taskid.
I want Actual to show the sum of the quantities of all project transactions that contain employeeid, projectid etc. Pretty simple right? I know theres a SumCalc but am not sure on how to use it.

There is no attribute in Acumatica to calculate total sum for an unbound field. The PXFormulaAttribute and the PXUnboundFormulaAttribute are designed to always store aggregated value inside a bound field.
To calculate total sum for an unbound field, you should implement FieldSelecting handler as shown in Step 11.8: Calculating the Total Amount of the T300 training course.

Related

Add a custom field to pricelist and multi-currency calculations in Odoo 13

In Odoo 13 I have added a custom field to the product.template model that is displayed on order lines.
Some products will use the sliding price scale dependent on quantity.
I have created a pricelist in a different currency that refers to my base pricelist.
I am trying to include my custom field in the pricelist methods that retrieve the sliding scale price and/or the converted currency value.
I have looked at overriding various methods but have not been successful because it seems many of the base methods have the product price field hardcoded as the value to use.
AM I missing something simple? Is there an easier way of including my custom field, or would I have to override many methods to include my custom field?

Acumatica Formula for Dividing 2 values

I am trying to divide values and display it in a new custom field(usrQuantity)on Stock Items Screen.
I want to divide OpenQty (which is a column in POLine) and CARTONQTY(which is not a column name but just an attribute in column AttributeID in CSAnswers table).
enter image description here
I am confused how to perform this division since CARTONQTY is not a field, I noticed that there is a field named CARTONQTY_Attributes in InventoryItem table which has been generated by some Join queries but is not actually present in the Database(checked in SQL Management Studio).
enter image description here
I tried this formula in the DAC of usrQuantity
[PXDBInt]
[PXUIField(DisplayName="Quantity")]
[PXFormula(typeof(Div<POLine.orderQty,InventoryItem.CARTONQTY_Attributes>))]
But it is giving following errors
The type or namespace name 'POLine' could not be found (are you missing a using directive or an assembly reference?)
The type name 'CARTONQTY_Attributes' does not exist in the type 'PX.Objects.IN.InventoryItem'
Do you want to store the value in the db? Typically it's not recommended practice to persist calculated values unless, for example, there's a performance issue in performing the calculation on the fly. If you don't want to store it, you probably want a PXInt instead of PXDBInt. Also, unless you always expect a whole number as a result of your division (which is unlikely), you should probably use a PXDecimal type.
To then get your calculated value into your new field, I would probably set it in RowSelecting and RowUpdated event handlers by extending the appropriate PXGraph class; in order to calculate it as you retrieve a row and when you update the row values.

Azure Search min max values

I have an index that is populated with Products. Each product has price field. I want to implement facet navigation on categories pages and i want my users to be able to search for products within a price range. At the same time, I want them to know what the minimum and maximum product price is across products in selected category. As i know Azure Search does not support min/max values in responses. So i am looking for some work around. I think that i can mark my price field as facetable and get min and max value from facet result, but default facet results count is 10, and if i understand correctly to get all prices from facet result i need to set count to Int.Max or something. That does not sound nice.
So what is the best solution to get min and max product price in specific category?
More direct approach to get the min and max product prices would be using $filter, $orderBy and $top in a Search request.
For example,
https://[service name].search.windows.net/indexes/products/docs?search=*&$filter=productName eq 'Toys'&$orderBy=price asc&$top=1.
You will need to parse the price in the response.
The approach using facet would be more expensive and, as you said, can only get you an approximation because boundaries of each facet is from pre-configured range.
Nate

SSAS, dimension numeric value filtering

I am using the multiple dimensional model in SSAS with a seemingly simple requirement.
I have a Product dimension table with a Price attribute. Using Excel pivot-table, I want to filter this Price attribute, for example "greater than $1000". However the filter in the pivot table is a string only, hence I can not do perform any numerical comparison operations, but rather for equivalent strings, e.g. "$1,000.00".
My problem is similar to this thread, and I wonder if there is a solution/work around that I missed?
Best regards,
CT
As suggested in the thread that you link, you could create a measure for the price, and then filter that. The definition of this calculated measure would be something like
[Product].[Product].Properties("Price", TYPED)
assuming the dimension as well as the attribute are named "Product", and the attribute has the price defined as a property named "Price".
(You define a property in BIDS as a relationship from the Product attribute to the Priice attribute.)

SharePoint unique values from lookup

I have a list with a lookup column that is getting "Created" dates from another list, but I only want the unique date values. Is there a way to get this data or to create a calculated column with unique values?
A lookup field actually links to a single item, the display value is more a "human readable" value for the link to the items ID value.
You may also get some mileage from a normal text or even date field and using jQuery and SPServices on the edit and new forms in order to provide changes to the form for the user. This avoids doing a code level customisation for the site that a Custom Field would require.
Not out of the box I dont think. My best bet is to create a Custom Field type that extends lookup with the functionality you are after.

Resources