Solved

Simple SelectFrom but getting 'Single row was requested' error.

  • 27 November 2023
  • 4 replies
  • 86 views

Userlevel 1
Badge

I have a simple SelectFrom where I am getting all of the AMBomMatl items (joining them with the Operation and BomItem tables) who’s ItemClassID equals ‘811’, but for some reason I am not getting any results. When I look through the var object results I only noticethe ‘Single row was requested’ error which to be honest I don’t know what it means.

I have been following this documentation but with no luck. I have done other SelectFrom’s before with success but not this for some reason. Any ideas?

 

icon

Best answer by manley75 1 December 2023, 00:06

View original

4 replies

Userlevel 4
Badge +2

I can’t see the entire ‘<in>’ clause of your Foreach loop, but my guess is that it is returning multiple lines based on the where criteria of the code that starts with “bomResults.Cast….” instead of one PXResult item

Userlevel 7
Badge +5

@manley75 it is because the Selects in Acumatica are ‘Lazy’, that is they will be only executed when the result is used. 

I’d say if you want to see what’s being selected, convert it into List right away where you do your select. 

Userlevel 1
Badge

Sorry I have been busy the last few days and only just got back to this problem.

It turns out this is indeed a rookie mistake. I forgot to join in the INItemClass table with the InventoryItem table to be able to use the ItemClassCD reference. Instead I was using the ItemClassID and trying to pipe in the user friendly CD 811 number.

It works now that I have made those changes. Thanks for making suggestions though!

Userlevel 7
Badge

Thank you for sharing your solution with the community @manley75!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved