Skip to main content
Solved

PR ON MAINT MATERIAL REQ LINE

  • November 24, 2020
  • 8 replies
  • 167 views

Forum|alt.badge.img+7

I am trying to see if a Part that i have on a MMR is currently on a PR i tried to use the below column SQL but keep getting a error message that missing expression, did i do this one wrong

 

(CASE WHEN (SELECT COUNT(mmr.PART_NO) FROM &AO.maint_material_req_line mmr WHERE mmr.IS_CLOSED = 0  AND mmr.PART_NO = &AO.purchase_order_api.Get _Part_No(order_no))  >0  THEN 'MMR' ELSE 'NO MMR' END)

 

 

Best answer by Technical Outlaws

Try this.

 

CASE WHEN (SELECT COUNT(*) FROM &AO.purchase_req_line_all a WHERE a.part_no = PART_NO) > 0 THEN 'MMR' ELSE 'NO MMR' END

This topic has been closed for replies.

8 replies

Technical Outlaws
Hero (Employee)
Forum|alt.badge.img+11

You have a space between the word Get and the first underscore!

Get _Part_No


Forum|alt.badge.img+7
  • Author
  • Sidekick
  • November 24, 2020

Now i get a different Error

 

 


Technical Outlaws
Hero (Employee)
Forum|alt.badge.img+11

Yes, this method doesn’t actually exist.


Forum|alt.badge.img+7
  • Author
  • Sidekick
  • November 24, 2020

Is there another way i could write it, to pull the information i am looking for? thank you for your help


Technical Outlaws
Hero (Employee)
Forum|alt.badge.img+11

I don’t know your exact requirements, but in your case statement can you not just do a count on the purchase requisition line using the maint_material_req_line_uiv part instead?!

 

CASE WHEN SELECT COUNT(*) FROM purchase_req_line_all a WHERE a.part_no = PART_NO > 0 THEN ‘MMR’ ELSE ‘NO MMR’ END


Forum|alt.badge.img+7
  • Author
  • Sidekick
  • November 24, 2020

Just trying to see if a part that is on a MMR is also on a PR

I tried the way you mentioned above and says missing expression do you know what might be missing i tried adding in ( at the beginning and it still didn't like it LOL


Technical Outlaws
Hero (Employee)
Forum|alt.badge.img+11

Try this.

 

CASE WHEN (SELECT COUNT(*) FROM &AO.purchase_req_line_all a WHERE a.part_no = PART_NO) > 0 THEN 'MMR' ELSE 'NO MMR' END


Forum|alt.badge.img+7
  • Author
  • Sidekick
  • November 26, 2020

Thank you looks like it’s going to work