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 total Amount. 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, and Amount. 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

Main Line is Yes

Returns only the header row for each transaction. You will get one row per transaction.

Main Line is No

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 Line is Yes. Group by Customer and Sum the Amount field.

  • Goal: Count the number of invoices created this month.

  • Method: Create a summary search with Main Line is Yes. Count the Internal ID field.

  • Goal: List all open sales orders and their statuses.

  • Method: Create a detail search with Main Line is Yes and filter for Status is Sales 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 Line is No and Item is your specific item. Sum the Quantity field.

  • Goal: Report on sales revenue broken down by item category.

  • Method: Create a summary search with Main Line is No. Group by the item's category field and Sum the Amount field.

  • Goal: Find all transactions where a specific discount was applied at the line level.

  • Method: Create a detail search with Main Line is No and filter for the specific Discount 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 Line is Yes to see only one row per transaction.

  • Problem: My summary totals are way too high.

  • Cause: You are summing the Amount column 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 Line is Yes before summing the Amount field.

**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 total Amount. 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, and Amount. 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

Main Line is Yes

Returns only the header row for each transaction. You will get one row per transaction.

Main Line is No

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 Line is Yes. Group by Customer and Sum the Amount field.

  • Goal: Count the number of invoices created this month.

  • Method: Create a summary search with Main Line is Yes. Count the Internal ID field.

  • Goal: List all open sales orders and their statuses.

  • Method: Create a detail search with Main Line is Yes and filter for Status is Sales 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 Line is No and Item is your specific item. Sum the Quantity field.

  • Goal: Report on sales revenue broken down by item category.

  • Method: Create a summary search with Main Line is No. Group by the item's category field and Sum the Amount field.

  • Goal: Find all transactions where a specific discount was applied at the line level.

  • Method: Create a detail search with Main Line is No and filter for the specific Discount 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 Line is Yes to see only one row per transaction.

  • Problem: My summary totals are way too high.

  • Cause: You are summing the Amount column 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 Line is Yes before summing the Amount field.

**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