NetSuite Saved search - available inventory comparison between 2 locations - switch-statement

I am trying to build a saved search that can perform available inventory comparison between two locations. It will display inventory items that have low inventory less than or equal to 2 at one location, and if the same items have inventory available at another location equal to or greater than 2, so we then use that information to perform inventory transfers. Ideally, I want to then use the saved search and try to build a scheduled workflow to then create auto inventory transfer records.
I currently have a saved search which lists columns of available inventory by each location. We then have to export the saved search into excel and then filter down the list of items based on above comparisons, and then create inventory transfers via csv imports. Again, at this point I am trying to build a saved search which will eliminate the use of excel.

CASE WHEN {inventorylocation.id} = '1' AND {locationquantityavailable} >= 2 THEN (CASE WHEN {inventorylocation.id} = '6' AND {locationquantityavailable} <= 2 THEN 1 ELSE 0 END) ELSE 0 END
Yes , this worked for me

Related

Calculation of the relative sales index in Spotfire compared to sales in 1 selected base plan

I have got the following data in Spotfire for which I would like to show the relative index of the sales per product compared with a selected base plan.
As shown in the picture above it is possible to calculate the index relative to the previous plan with the following over statement:
100 * (Sum([Sales]) - Sum([Sales]) OVER (PreviousPeriod([Axis.Columns]))) /
Sum([Sales]) OVER (PreviousPeriod([Axis.Columns]))
However this solution has the following three shortcomings:
It compares all sales with the sales in the previous plan instead of one base plan. Changing the OVER statement to use the FirstNode doesn't always work because the data in the real application is imported from the database based upon a query. This results in the value of the FirstNode not always being available.
The ordering of the plans is based upon the string value instead of the plan number (second character in the plan name).
The base plan is not selectable. In the real application a document property "SelectedPlan" is created (containing the selected value in a drop down list).
So how is it possible to calculate the relative sales index compared to the sales of 1 selected base plan?
After some more research we have found a working solution:
100 * (Sum([Sales]) / Sum(If([Plan] = '${SelectedPlan}',[Sales],0)) OVER All([Axis.Columns]))

How to get Divisions and regions of customers in a saved search?

Can I create a saved search in NetSuite to display divisions and regions of customers?
I am trying to get division and regions off a saved search i.e. division and location of customer's transactions in a saved search.
You can write a search with following criteria
1) Customer : internalid anyof CUSTOMER_INTERNAL_ID
2) Mainline is T
3) Type anyof Sales Order, Cash Sale, ANY_OTHER_APPLICABLE_CUSTOMER_TRANASACTION
In the search column add
1) Department with summary type Group
2) Location with summary type Group
Remove any other search columns from the result as adding unwanted fields with incorrect grouping will lead to duplicate results
If you want to get departments and columns of all customers within a single search you can remove filter #1 and add a search column customer with summary type as group

NetSuite Eliminate Duplicates from Saved Item Search

I am making a saved search to show all of the items in our inventory with quantity details, but when I preview the saved search many duplicate products are displayed to the screen. How can I eliminate the duplicates? Also, how would I eliminate any Kit/Package items?
It is likely you have multiple location inventory turned on but are not filtering by nor including a column for the Inventory Location. If you include the Inventory Location column you'll see that the lines are not duplicates.
If you don't have inventory in a number of locations you can filter on Location On Hand is greater than 0. The filters to use here depend on what you are trying to see.
You would eliminate Kits/Packages by filtering on Type == Inventory Part
To eliminate only Kits/Package items from search results you can use filter criteria - Type none of Kits/Package Item.
If you are using multiple locations and you do not want to see multiple results for same item - I would recommend writing a grouped/summary search by specifying summary types for fields in the results/search columns:
1) All Item details like - Name, display name , etc. with summary type as group
2) All inventory count field such as Location on Hand, Location Available, Location Back Ordered, etc. should have summary type as Sum

Formula in Netsuite Saved Search

I have a problem here. In Column 1 I have count of All he transaction, In column 2 I have Count of transaction of specific status. In column 3 I want the percentage of above 2; like count of specific transaction/Count of total. Is it possible in Netsuite?
Actually there is an interesting feature that makes this possible. Formula fields that have aggregate functions work when the row has an aggregate on it. So for instance if you wanted to see a percentage of orders with status Billed on a Sales Order search you would enter a Formula (Percent) result with a formula like:
sum(case when {status} = 'Billed' then 1 else 0 end) / count({tranid})
and apply an aggregate to that column. The sample uses Maximum but Minimum and Average produce the same result.
I think that isn't possible by just saved search.
You will have to group on search result column status, so, all the count total will be based on statuses and you can't write aggregation based on other search results' columns.
you can further write a suitelet/portlet script to use the saved search result and calculate the stats before presenting on UI.

Get the average monthly value from 2 SP List columns and display in new column

I need to calculate the average value for each month. Currently I have 2 columns "DATE" (date value e.g 01/01/2010) and AccOpen (number value). So for all dates within January I need to return the average value of all numbers contained in the corresponding AccOpen rows for January dates.
Is it possible to use the CALCULATED option and input a FORMULA that will return the average for all itmes within each months period (when adding a column to the list ?
DATE ACCOPEN AVERAGE
01/01/2010 2 2
02/01/2010 2
03/01/2010 2
04/01/2010 2
01/02/2010 2 2
02/02/2010 2
03/02/2010 2
04/02/2010 2
You're not going to be able to do this OOTB without writing event receiver code (or other custom code running in a batch mode).
To get you started
MSDN - How to: Create an Event Handler Feature
Event Handlers : Everything you need to know...
This will need to hook into the list item update and then consolidate your list into a separate summary list with the calculations you need.
The brute force approach would be to run the calculation afresh for every item in the group when an item is inserted/updated.
A smarter approach would be to just update the delta (the difference between the old and the new record) which is easier to do if you store components of the calculation - so in your case
Month - NumRecords - TotalValue
and work out the Average on the fly (as its easy to delta the NumRecords/TotalValue but impossible to apply it directly to the average)
One 3rd party web part which may fit your need is PivotPoint - it allows you to do things like sum/count/avg over groups like Month & Year (disclaimer - I work for the company)
It is not possible to query anything other than the current item when creating a formula field.
The only way to do this is to create custom code either within an event handler for the list or external code that processes items in the list and updates a "average" field when required.
Create a calculated field to give you the year and month, for example: 2011-07. Then modify your list view to group on the calculated field. When editing your view, there is also an option to display totals, I believe you can set this to average for your AccOpen column. If you're not interested in the details, you can choose to collapse all groups by default.

Resources