Searching Transaction Lines vs. the Main Record: A Guide to the Main Line Filter
Searching Transaction Lines vs. the Main Record: A Guide to the Main Line Filter
Searching Transaction Lines vs. the Main Record: A Guide to the Main Line Filter
Without properly filtering for one or the other, your search results can appear to have duplicates and your summary calculations will be incorrect. The key to controlling this is the Main Line filter.
Without properly filtering for one or the other, your search results can appear to have duplicates and your summary calculations will be incorrect. The key to controlling this is the Main Line filter.
Without properly filtering for one or the other, your search results can appear to have duplicates and your summary calculations will be incorrect. The key to controlling this is the Main Line filter.
7 min read
One of the most common points of confusion when building a transaction saved search is understanding the difference between the main record (the "header") and its individual line items. Without properly filtering for one or the other, your search results can appear to have duplicates and your summary calculations will be incorrect. The key to controlling this is the Main Line filter.
The Structure of a Transaction
Think of a transaction like an invoice as having two distinct parts:
Header (Main Line): This is the top-level information that applies to the entire transaction. It includes fields like
Customer,Date,Status, and the totalAmount. In a search, this represents a single row.Lines: These are the individual items or expenses that make up the transaction. Each line has its own details, such as
Item,Quantity, andAmount. In a search, each line represents its own row.
When you run a transaction search without any filtering, NetSuite returns a row for the header and a row for every single line item. This is why a single invoice with five items can appear as six rows in your search results, leading to confusion and incorrect totals if you try to sum the Amount column.
Using the Main Line Filter
The Main Line filter is the definitive way to control which part of the transaction your search returns. You add it on the Criteria subtab of your saved search.
Filter Setting | Result |
|---|---|
| Returns only the header row for each transaction. You will get one row per transaction. |
| Returns only the line-item rows. You will get one row for each line on the transaction. |
When to Use "Main Line is Yes"
Use this filter when you are interested in information about the transaction as a whole.
Goal: Find the total sales amount for each customer.
Method: Create a summary search with
Main LineisYes. Group byCustomerandSumtheAmountfield.Goal: Count the number of invoices created this month.
Method: Create a summary search with
Main LineisYes.CounttheInternal IDfield.Goal: List all open sales orders and their statuses.
Method: Create a detail search with
Main LineisYesand filter forStatusisSales Order:Pending Fulfillment.
When to Use "Main Line is No"
Use this filter when you need to analyze the details within the transactions.
Goal: Find out how many units of a specific item were sold this quarter.
Method: Create a summary search with
Main LineisNoandItemis your specific item.SumtheQuantityfield.Goal: Report on sales revenue broken down by item category.
Method: Create a summary search with
Main LineisNo. Group by the item's category field andSumtheAmountfield.Goal: Find all transactions where a specific discount was applied at the line level.
Method: Create a detail search with
Main LineisNoand filter for the specificDiscount Item.
Common Mistakes and How to Fix Them
Problem: My search results look like they have duplicates, with the same transaction appearing multiple times.
Cause: You are seeing both the header and the line-item rows.
Fix: Add the filter
Main LineisYesto see only one row per transaction.Problem: My summary totals are way too high.
Cause: You are summing the
Amountcolumn without a Main Line filter, which means you are adding the header total to the sum of all the line-item amounts.Fix: Add the filter
Main LineisYesbefore summing theAmountfield.
**Best Practice:** Make it a habit to add the **Main Line** filter to every transaction search you create. Consciously deciding whether you need header-level or line-level data at the beginning will prevent the vast majority of common search errors.
One of the most common points of confusion when building a transaction saved search is understanding the difference between the main record (the "header") and its individual line items. Without properly filtering for one or the other, your search results can appear to have duplicates and your summary calculations will be incorrect. The key to controlling this is the Main Line filter.
The Structure of a Transaction
Think of a transaction like an invoice as having two distinct parts:
Header (Main Line): This is the top-level information that applies to the entire transaction. It includes fields like
Customer,Date,Status, and the totalAmount. In a search, this represents a single row.Lines: These are the individual items or expenses that make up the transaction. Each line has its own details, such as
Item,Quantity, andAmount. In a search, each line represents its own row.
When you run a transaction search without any filtering, NetSuite returns a row for the header and a row for every single line item. This is why a single invoice with five items can appear as six rows in your search results, leading to confusion and incorrect totals if you try to sum the Amount column.
Using the Main Line Filter
The Main Line filter is the definitive way to control which part of the transaction your search returns. You add it on the Criteria subtab of your saved search.
Filter Setting | Result |
|---|---|
| Returns only the header row for each transaction. You will get one row per transaction. |
| Returns only the line-item rows. You will get one row for each line on the transaction. |
When to Use "Main Line is Yes"
Use this filter when you are interested in information about the transaction as a whole.
Goal: Find the total sales amount for each customer.
Method: Create a summary search with
Main LineisYes. Group byCustomerandSumtheAmountfield.Goal: Count the number of invoices created this month.
Method: Create a summary search with
Main LineisYes.CounttheInternal IDfield.Goal: List all open sales orders and their statuses.
Method: Create a detail search with
Main LineisYesand filter forStatusisSales Order:Pending Fulfillment.
When to Use "Main Line is No"
Use this filter when you need to analyze the details within the transactions.
Goal: Find out how many units of a specific item were sold this quarter.
Method: Create a summary search with
Main LineisNoandItemis your specific item.SumtheQuantityfield.Goal: Report on sales revenue broken down by item category.
Method: Create a summary search with
Main LineisNo. Group by the item's category field andSumtheAmountfield.Goal: Find all transactions where a specific discount was applied at the line level.
Method: Create a detail search with
Main LineisNoand filter for the specificDiscount Item.
Common Mistakes and How to Fix Them
Problem: My search results look like they have duplicates, with the same transaction appearing multiple times.
Cause: You are seeing both the header and the line-item rows.
Fix: Add the filter
Main LineisYesto see only one row per transaction.Problem: My summary totals are way too high.
Cause: You are summing the
Amountcolumn without a Main Line filter, which means you are adding the header total to the sum of all the line-item amounts.Fix: Add the filter
Main LineisYesbefore summing theAmountfield.
**Best Practice:** Make it a habit to add the **Main Line** filter to every transaction search you create. Consciously deciding whether you need header-level or line-level data at the beginning will prevent the vast majority of common search errors.
Ready to Work Together?
Ready to Work Together?
Ready to Work Together?
Let us talk about your NetSuite challenges and how we can help. No pressure, no sales pitch. Just a straightforward conversation.
Let us talk about your NetSuite challenges and how we can help. No pressure, no sales pitch. Just a straightforward conversation.
Author


Michael Strong
Michael Strong
Founder & Principal Architect
Founder & Principal Architect
Tags
Read More
Read More


