SAP Business One Query: Customers Added Within a Certain Number of Days
Query will prompt the user for a number of days and show the customers that were added within that number of days. Copy and paste into the Query Generator and run.
/*This query will return all customers that have been added to the system */
/*within the number of days selected by the user. Leaving the number of */
/*days blank will return all customers*/
/*Sorted by Days Added Ago Acending */
/*Parameter Definitions*/
/*SELECT FROM [dbo].[ODUN] T0*/
declare @Days as int
/* WHERE */
set @Days = /* T0.EffctAftr */ ‘[%0]‘
/*Main Query Definition*/
SELECT T0.CardCode as ‘Customer#’, T0.CardName, T0.CreateDate
,datediff (day,T0.CreateDate,GetDate()) as ‘Days Ago’
FROM OCRD T0
WHERE T0.CardType=’C’ and (@days = 0) or (GetDate() – @Days) <= T0.CreateDate
ORDER BY ‘Days Ago’
FOR BROWSE
Thanks to Ed Monk of SBONotes.com
© 2009, Mark Chinsky. All rights reserved. Formed in 2005. the 90 Minds Consulting Group is a collaboration of 100 Sage partners who independently join together online in a 24 x 7 private communication network to solve difficult issues for their customers. The group is not affiliated with Sage and our collaboration provides for unparalleled member access to early warnings of bugs and other issues which members in turn are encouraged to use to provide an exceptional customer experience.
« SAP Business One Enhanced User Prompts in Queries | Home | SAP Business One Assigning a Formatted Search Query to a Field »


Leave a Comment
You must be logged in to post a comment.