Multiple orderby and groupby

Good day, I'm trying to get data where my Lot Numbers repeat and I want to consolidate them in 1 single record. This is the code I tried for retreiving the data:
dataString='/data/v1/reserve?filter=Org='+ orgFilter + ', Planner='+ pcFilter + '';//'&groupby=LotNumber';
It does get the records and groups them, but instead of showing for example the Part Number, it displays a number (I assume it's the ID)...
I attach a snapshot of the output of this line of code (replacing the blank quotation marks with the commented string).
Any ideas on what's wrong with this?
Thanks in advance.
Best Answer
-
Martin,
If you don't specify an aggregation for the fields, you'll get the following behavior, as described in the Data API reference on developer.domo.com:
By default, numerical columns are summed and unique entries of non-numerical columns are counted. Can be combined with an aggregation to override this default behavior.
So what you're seeing is count of records for each of the string fields (Part Number, Description, etc.), and a sum for numeric fields (quantity).
If you want to see the part number, you'd need to add it to your groupby clause (groupby=LotNumber,PartNumber). That means, though, that you're going to be getting one record per combination of lot number and part number. If you have multiple lots of the same part, you'll see a record for each lot with the part number repeated on each record.
I hope that helps!
1
Answers
-
Martin,
If you don't specify an aggregation for the fields, you'll get the following behavior, as described in the Data API reference on developer.domo.com:
By default, numerical columns are summed and unique entries of non-numerical columns are counted. Can be combined with an aggregation to override this default behavior.
So what you're seeing is count of records for each of the string fields (Part Number, Description, etc.), and a sum for numeric fields (quantity).
If you want to see the part number, you'd need to add it to your groupby clause (groupby=LotNumber,PartNumber). That means, though, that you're going to be getting one record per combination of lot number and part number. If you have multiple lots of the same part, you'll see a record for each lot with the part number repeated on each record.
I hope that helps!
1 -
Thanks! That fixed my issue.
0
Categories
- All Categories
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 311 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 659 Datasets
- 116 SQL DataFlows
- 2.2K Magic ETL
- 816 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 82 App Studio
- 45 Variables
- 776 Automate
- 190 Apps
- 481 APIs & Domo Developer
- 82 Workflows
- 23 Code Engine
- 41 AI and Machine Learning
- 20 AI Chat
- 1 AI Playground
- 2 AI Projects and Models
- 18 Jupyter Workspaces
- 411 Distribute
- 120 Domo Everywhere
- 280 Scheduled Reports
- 11 Software Integrations
- 144 Manage
- 140 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 115 Community Announcements
- 4.8K Archive