<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title> &#187; Queries</title>
	<atom:link href="http://www.90minds.com/category/sap-business-one/queries/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.90minds.com</link>
	<description></description>
	<lastBuildDate>Sat, 11 Feb 2012 22:14:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>SAP Business One How to Copy One Screen Layout to Another User</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-how-to-copy-one-screen-layout-to-another-user/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-how-to-copy-one-screen-layout-to-another-user/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 17:22:30 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Queries]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-how-to-copy-one-screen-layout-to-another-user/</guid>
		<description><![CDATA[NOTE: This example is not recommended for novice users. You must have access to the SBO SQL Database and be comfortable with updating your production database. Updating your production database directly could void your SBO warranty and/or service agreement. Please consult with a DBA before proceeding. Updating queries cannot be run within the SBO query [...]]]></description>
			<content:encoded><![CDATA[<p><strong>NOTE: This example is not recommended for novice users. You must have access to the SBO SQL Database and be comfortable with updating your production database. Updating your production database directly could void your SBO warranty and/or service agreement. Please consult with a DBA before proceeding. Updating queries cannot be run within the SBO query tool.</strong></p>
<p> <strong></strong>
<p>If you need to have all of your users have the same screen layouts (e.g., the same columns in the same order within the Purchase Order) you can use this qery to quickly copy the settings from one user to another. Obtain the UserID numbers with this query, run it in SBO or another tool:</p>
<p>SELECT UserID, U_Name FROM OUSR ORDER BY U_Name</p>
<p>I recommend that you create a dummy user name and set your screen formats for a group of people, just like you should when setting authorizations.</p>
<p>Declare @target as smallint    <br />Declare @source as smallint    <br />Declare @form as nvarchar(20)    <br />/* Change this to the Target UserID (number from OUSR) */    <br />Set @target = 2    <br />/* Change this to the Form number obtained from the Sys Info Line at bottom of SBO */    <br />Set @form = 142    <br />/* Change this to the Source UserID */    <br />Set @source = 22    <br />/* Removes the temp table if it already exists. */    <br />/* temp_settings is created and destroyed only for this operation */    <br />if exists (select 1 from sysobjects where name = &#8216;temp_settings&#8217;)    <br />Begin    <br />drop table temp_settings    <br />End    <br />/*Copy from the source ID for a specific form */    <br />Select * into temp_settings from CPRF where usersign = @source and FormID = @form    <br />/* Remove the target info for the form and user */    <br />Delete from CPRF where usersign = @target and FormID = @form    <br />/* Change the UserID in the Temp table to the new user ID */    <br />Update temp_settings Set usersign = @target    <br />/* Put the information back into the SBO forms table */    <br />Insert into CPRF Select * from temp_settings    <br />/* Removes the table just in case! */    <br />Drop Table temp_settings</p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
<p style='text-align:left'>&copy; 2009, <a href='http://www.90minds.com'>Mark Chinsky</a>. 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.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-how-to-copy-one-screen-layout-to-another-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP Business One How to Access the Query Manager</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-how-to-access-the-query-manager/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-how-to-access-the-query-manager/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 17:19:08 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Queries]]></category>
		<category><![CDATA[Reporting]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-how-to-access-the-query-manager/</guid>
		<description><![CDATA[Access the Query Manager in two ways: From the drop-down menus at the top of the screen, go to: Tools -&#62; Queries -&#62; Query Manager Click on the Query Manager icon located on the icon bar at the top of the screen. The Query Manager window will appear&#8230; Thanks to Ed Monk of SBONotes.com &#169; [...]]]></description>
			<content:encoded><![CDATA[<p>Access the Query Manager in two ways:</p>
<ul>
<li>
<p>From the drop-down menus at the top of the screen, go to: Tools -&gt; Queries -&gt; Query Manager</p>
</li>
<li>
<p>Click on the Query Manager icon located on the icon bar at the top of the screen.</p>
</li>
</ul>
<p><img alt="" src="http://4.bp.blogspot.com/_1ULSO0XKfTI/SEfuBM-iiOI/AAAAAAAAAGg/-LTdWjITQXc/s400/Access_Query_Manager.jpg" border="0" /></p>
<p>The Query Manager window will appear&#8230;</p>
<p><img alt="" src="http://2.bp.blogspot.com/_1ULSO0XKfTI/SEfuTMi0UPI/AAAAAAAAAGw/lqgJcBe4_2g/s400/Query_Manager_Window.jpg" border="0" /></p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
<p style='text-align:left'>&copy; 2009, <a href='http://www.90minds.com'>Mark Chinsky</a>. 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.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-how-to-access-the-query-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Make a Print Layout (PLD) Report from a SBO Query</title>
		<link>http://www.90minds.com/2009/02/11/how-to-make-a-print-layout-pld-report-from-a-sbo-query/</link>
		<comments>http://www.90minds.com/2009/02/11/how-to-make-a-print-layout-pld-report-from-a-sbo-query/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 17:18:04 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Queries]]></category>
		<category><![CDATA[Reporting]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/how-to-make-a-print-layout-pld-report-from-a-sbo-query/</guid>
		<description><![CDATA[Follow these steps: Create a Query in SAP Business One Open the Query Manager Find your Report Highlight your report (single click) Click on the Create Report button at the bottom of the window. A window appears with the name of your query at the top of the window. Window is divided into two parts: [...]]]></description>
			<content:encoded><![CDATA[<p>Follow these steps:</p>
<ol>
<li><a href="http://www.sbonotes.com/2007/07/creating-custom-queries.html">Create a Query in SAP Business One</a></li>
<li><a href="http://www.sbonotes.com/2008/06/how-to-access-query-manager.html">Open the Query Manager</a></li>
<li>Find your Report</li>
<li>Highlight your report (single click)</li>
<li>Click on the <em>Create Report</em> button at the bottom of the window.</li>
<li>A window appears with the name of your query at the top of the window.</li>
<li>Window is divided into two parts: Top is existing reports, bottom is a list of the report templates.</li>
<li>Click on the <em>User Report (System)</em> template in the bottom part of the window.</li>
<li>Click the <em>OK</em> button.</li>
<li>You are returned to the Query Manager     <br />(At this point you are probably thinking that nothing happened, but it did).</li>
<li>Click on the <em>Create Report</em> button once more.</li>
<li>The <em>Create User Report</em> window opens again. Now in the top part (the box under <em>Name</em>) of the window you will see the name of the report you were trying to create. This indicates that the initial report was created successfully.</li>
<li>Now&#8230;Double Click on the the name of your query in that section and the Print Layout Designer (PLD) windows will open and allow you to modify the layout of the query information on the report.</li>
</ol>
<p>After you have completed your changes to the layout and have saved your work, you can see the actual printed document by accessing the Query Manager, highlighting your report name, and clicking the print preview icon at the top of the screen.</p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
<p style='text-align:left'>&copy; 2009, <a href='http://www.90minds.com'>Mark Chinsky</a>. 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.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/how-to-make-a-print-layout-pld-report-from-a-sbo-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP Business One Query to Show Open Balances by Customer (or Vendor)</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-query-to-show-open-balances-by-customer-or-vendor/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-query-to-show-open-balances-by-customer-or-vendor/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 17:11:44 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Alerts]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Queries]]></category>
		<category><![CDATA[Reporting]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-query-to-show-open-balances-by-customer-or-vendor/</guid>
		<description><![CDATA[Use this query to show you a list of open balances by customer group. If you would like to see open balances by vendor, then change the Where clause to cs.cardtype = &#8216;S&#8217;. /* Shows the open balances by Customer Group */ SELECT gp.GroupCode, gp.GroupName, Sum(cs.Balance) &#8216;Open Balance&#8217; FROM OCRD cs INNER JOIN OCRG gp [...]]]></description>
			<content:encoded><![CDATA[<p>Use this query to show you a list of open balances by customer group. If you would like to see </p>
<p>open balances by vendor, then change the <em>Where</em> clause to <em>cs.cardtype = &#8216;S&#8217;</em>.</p>
<p>/* Shows the open balances by Customer Group */   <br />SELECT gp.GroupCode, gp.GroupName, Sum(cs.Balance) &#8216;Open Balance&#8217;</p>
<p>FROM OCRD cs   <br />INNER JOIN OCRG gp ON gp.GroupCode = cs.GroupCode </p>
<p>WHERE cs.CardType = &#8216;C&#8217;</p>
<p>GROUP BY gp.GroupCode, gp.GroupName   <br />ORDER BY GroupName    <br />FOR BROWSE</p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
<p style='text-align:left'>&copy; 2009, <a href='http://www.90minds.com'>Mark Chinsky</a>. 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.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-query-to-show-open-balances-by-customer-or-vendor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP Business One Alerts Check for BP Tax Codes</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-alerts-check-for-bp-tax-codes/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-alerts-check-for-bp-tax-codes/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 17:05:40 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Alerts]]></category>
		<category><![CDATA[Queries]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-alerts-check-for-bp-tax-codes/</guid>
		<description><![CDATA[If a state tax code was not entered on the Customer&#8217;s Ship-To address then when the Sales Order is invoiced you will receive a message stating that the tax code was not provided for the order. This Alert will notify someone when the tax code was not entered. Create a Query with the following SQL [...]]]></description>
			<content:encoded><![CDATA[<p>If a state tax code was not entered on the Customer&#8217;s Ship-To address then when the Sales Order is invoiced you will receive a message stating that the tax code was not provided for the order. This Alert will notify someone when the tax code was not entered. Create a Query with the following SQL and associate it with an alert:   <br />SELECT     <br />T1.CardCode AS &#8216;BP Code&#8217;    <br />,T1.CardName AS &#8216;BP Name&#8217;    <br />,T0.TaxCode AS &#8216;Tax Code&#8217;     <br />FROM [dbo].[CRD1] T0     <br />INNER JOIN [dbo].[OCRD] T1 ON T1.CardCode = T0.CardCode     <br />WHERE T0.TaxCode = &#8216; &#8216; AND T0.AdresType = N&#8217;S&#8217; AND T1.CardType = N&#8217;C&#8217;     <br />FOR BROWSE</p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
<p style='text-align:left'>&copy; 2009, <a href='http://www.90minds.com'>Mark Chinsky</a>. 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.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-alerts-check-for-bp-tax-codes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP Business One Retrieving the Ship-To State for a Sales Order</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-retrieving-the-ship-to-state-for-a-sales-order/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-retrieving-the-ship-to-state-for-a-sales-order/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 16:58:10 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Formatted Search]]></category>
		<category><![CDATA[Queries]]></category>
		<category><![CDATA[Reporting]]></category>
		<category><![CDATA[UDF (User Defined Fields)]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-retrieving-the-ship-to-state-for-a-sales-order/</guid>
		<description><![CDATA[It was important to one client to be able to do sales reporting by state (which was done using the query tool). In SBO, the address on the marketing documents is one large field and you cannot get the state unless you get the information from the BP (Business Partner) master for scan through the [...]]]></description>
			<content:encoded><![CDATA[<p>It was important to one client to be able to do sales reporting by state (which was done using the query tool). In SBO, the address on the marketing documents is one large field and you cannot get the state unless you get the information from the BP (Business Partner) master for scan through the field for specific characters and pull out the state information. </p>
<ol>
<li><a href="http://sbonotes.blogspot.com/2007/07/creating-user-defined-field-for.html">Create a UDF (User Defined Field)</a> for the marketing document header.</li>
<li><a href="http://sbonotes.blogspot.com/2007/07/creating-custom-queries.html">Create a custom query</a> and insert the code below into the query statement area. The query below will take the <em>Ship-To Code</em> selected and go to the Business Partner Master and get the correct Ship-To State. It will also look for a comma on a custom address (where a ship to code is not selected) and pull the state code from the two characters after the &quot;, &quot;:      <br />Select Case When $[ShipToCode] = &#8216; &#8216; Then Case When CHARINDEX(&#8216;,&#8217;,$[Address2])= 0 Then &#8216;??&#8217; Else Substring($[Address2], CHARINDEX(&#8216;,&#8217;,$[Address2])+1,2) END Else (Select ADR.State From CRD1 ADR Where $[CardCode] = ADR.CardCode and $[ShipToCode] = ADR.Address and ADR.ADRESTYPE = &#8216;S&#8217;)END</li>
<li>Now you can <a href="http://sbonotes.blogspot.com/2007/07/assigning-form-query-to-field.html">tie a query to the UDF (User Defined Field)</a> you created on a Marketing Document. You will have to assign the query on each marketing document you want the query to run on (e.g., Sales Order, Delivery Doc, etc.). <strong>Note: This query was assigned to run automatically when the <em>Ship to </em>field changed.</strong> That can be assigned on the Search Definition on the field.</li>
</ol>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
<p style='text-align:left'>&copy; 2009, <a href='http://www.90minds.com'>Mark Chinsky</a>. 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.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-retrieving-the-ship-to-state-for-a-sales-order/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP Business One Assigning a Formatted Search Query to a Field</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-assigning-a-formatted-search-query-to-a-field/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-assigning-a-formatted-search-query-to-a-field/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 16:54:59 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Formatted Search]]></category>
		<category><![CDATA[Queries]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-assigning-a-formatted-search-query-to-a-field/</guid>
		<description><![CDATA[Instuctions on how to assign a form query to a field: Open a form. Click on the field. Select for the drop down menus at the top of the screen: Tools-&#62;Search Function-&#62;Define A window will appear. Click on Search by Saved Query. Double Click on the long gray box below that option. The Query Manager [...]]]></description>
			<content:encoded><![CDATA[<p>Instuctions on how to assign a form query to a field:</p>
<ol>
<li>Open a form.</li>
<li>Click on the field.</li>
<li>Select for the drop down menus at the top of the screen:     <br /><em><strong>Tools-&gt;Search Function-&gt;Define</strong>        <br /><img alt="" src="http://1.bp.blogspot.com/_1ULSO0XKfTI/Ro6SreiD6tI/AAAAAAAAAB8/-R_rXib_f7Y/s320/Assign_Form_Query.jpg" border="0" /></em></li>
<li>A window will appear. <strong>Click on <em>Search by Saved Query</em></strong>. Double Click on the long gray box below that option. The Query Manager will open. Select the query you wish to run on the field you selected.      <br /><img alt="" src="http://4.bp.blogspot.com/_1ULSO0XKfTI/Ro6SUOiD6sI/AAAAAAAAAB0/NMbzcWkxuEc/s320/Assign_Form_Query_Window.jpg" border="0" />      <br />If you would like to have the value automatically populate when something else happens on the form, check the <strong><em>Auto Refresh When Field Changes </em></strong>box. From the drop down box below that option, select the field that will &quot;trigger&quot; the query to run on the field you selected.</li>
<li>To run the query on demand on the form, press <strong><em>Alt+F2</em></strong>. To change the field&#8217;s query assignment later you can press <strong><em>Alt+Shift+F2</em></strong> and the window above will be displayed. You can also follow the original drop down menu path listed above to perform the same action.</li>
</ol>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
<p style='text-align:left'>&copy; 2009, <a href='http://www.90minds.com'>Mark Chinsky</a>. 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.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-assigning-a-formatted-search-query-to-a-field/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SAP Business One Query: Customers Added Within a Certain Number of Days</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-query-customers-added-within-a-certain-number-of-days/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-query-customers-added-within-a-certain-number-of-days/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 16:51:52 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Queries]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-query-customers-added-within-a-certain-number-of-days/</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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 <em>Query Generator</em> and run.    <br />/*This query will return all customers that have been added to the system */    <br />/*within the number of days selected by the user. Leaving the number of */    <br />/*days blank will return all customers*/    <br />/*Sorted by Days Added Ago Acending */    <br />/*Parameter Definitions*/    <br />/*SELECT FROM [dbo].[ODUN] T0*/    <br />declare @Days as int    <br />/* WHERE */    <br />set @Days = /* T0.EffctAftr */ &#8216;[%0]&#8216;    <br />/*Main Query Definition*/    <br />SELECT T0.CardCode as &#8216;Customer#&#8217;, T0.CardName, T0.CreateDate    <br />,datediff (day,T0.CreateDate,GetDate()) as &#8216;Days Ago&#8217;    <br />FROM OCRD T0    <br />WHERE T0.CardType=&#8217;C&#8217; and (@days = 0) or (GetDate() &#8211; @Days) &lt;= T0.CreateDate    <br />ORDER BY &#8216;Days Ago&#8217;    <br />FOR BROWSE</p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
<p style='text-align:left'>&copy; 2009, <a href='http://www.90minds.com'>Mark Chinsky</a>. 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.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-query-customers-added-within-a-certain-number-of-days/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP Business One Enhanced User Prompts in Queries</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-enhanced-user-prompts-in-queries/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-enhanced-user-prompts-in-queries/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 16:49:16 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Queries]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-enhanced-user-prompts-in-queries/</guid>
		<description><![CDATA[The use of user prompted parameters in Business One queries provides powerful flexibility to the Business One reporting environment. A limitation was discovered with the use of this technique. It appears that some erroneous error messages can occur when the user prompted parameters are used in long queries or when they are used in certain [...]]]></description>
			<content:encoded><![CDATA[<p>The use of user prompted parameters in Business One queries provides powerful flexibility to the Business One reporting environment. A limitation was discovered with the use of this technique. It appears that some erroneous error messages can occur when the user prompted parameters are used in long queries or when they are used in certain nested SELECT statements. The work-around for this limitation is explained in the SAP note #730960. The note describes a process of building a definition for a user prompted parameter that overcomes the problem.   <br />It was discovered that this technique could also be used to provide a more visually appealing user prompt in the case where the user will be required to enter values to be used to generate the query.    <br />The technique allows any table/field to be used to define the user prompt. This means that the user prompt presented using this technique can be the field name for any data base field. There is no longer a limitation of having the user prompt text be that of the field that is being compared in the WHERE clause. So for example if the desire were to ask the user for a range of dates to qualify the document date with, the user prompt might appear as below.     <br /><img alt="" src="http://3.bp.blogspot.com/_1ULSO0XKfTI/RpPlLuiD6uI/AAAAAAAAACE/ZNMcI1MzHxo/s320/Query_Prompt_001.jpg" border="0" />    <br />Using the alternate technique a similar user prompt might appear as: </p>
<p><img alt="" src="http://2.bp.blogspot.com/_1ULSO0XKfTI/RpPlYeiD6vI/AAAAAAAAACM/a9-yM05JMZ8/s320/Query_Prompt_002.jpg" border="0" /> </p>
<p>If the terms &#8220;From Date&#8221; and &#8220;To Date&#8221; are more meaningful to the user as prompts, then this presentation may be a better one to accomplish the same purpose of asking for this range of dates.   <br />The query below can serve as an example of how this technique can be applied in order to change the prompts that the user is presented with when the query is executed. In this case the fields &#8216;FromDate&#8217; and &#8216;ToDate&#8217; from the table OSRT were used to prompt the user. </p>
<p>/*Parameter Area*/   <br />/*SELECT FROM [dbo].[OSRT] P0*/    <br />declare @StartDate as datetime    <br />/* WHERE */    <br />set @StartDate = /* P0.FromDate */ &#8216;[%0]&#8216;    <br />/*SELECT FROM [dbo].[OSRT] P1*/    <br />declare @EndDate as datetime    <br />/* WHERE */    <br />set @EndDate = /* P1.ToDate */ &#8216;[%1]&#8216;    <br />/*Main Query Area*/    <br />SELECT T0.DocNum &#8216;Inv#&#8217;,T0.DocDate &#8216;Post Date&#8217;,T0.CardCode &#8216;Customer#&#8217;,T0.CardName &#8216;Customer Name&#8217;    <br />FROM OINV T0    <br />WHERE (T0.DocDate &gt;= @StartDate and T0.DocDate &lt;= @EndDate) ORDER BY T0.DocDate, T0.CardCode FOR BROWSE</p>
<p style='text-align:left'>&copy; 2009, <a href='http://www.90minds.com'>Mark Chinsky</a>. 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.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-enhanced-user-prompts-in-queries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP Business One Birthday List! (without the year)</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-birthday-list-without-the-year/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-birthday-list-without-the-year/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 16:46:52 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Alerts]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Financials]]></category>
		<category><![CDATA[Queries]]></category>
		<category><![CDATA[Reporting]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-birthday-list-without-the-year/</guid>
		<description><![CDATA[A quick and easy query to give you a list of the birthdays from the Employee Master Data application in SBO. Copy and paste the lines below into the Query Generator tool. /*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;*/ /* Displays a list of all the employees in SBO with their birthdays (without the year) */ SELECT lastname as &#8216;Last Name&#8217; [...]]]></description>
			<content:encoded><![CDATA[<p>A quick and easy query to give you a list of the birthdays from the <em>Employee Master Data</em> application in SBO.</p>
<p>Copy and paste the lines below into the <em>Query Generator</em> tool.</p>
<p>/*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;*/   <br />/* Displays a list of all the employees in SBO with their birthdays (without the year) */</p>
<p>SELECT   <br />lastname as &#8216;Last Name&#8217;    <br />,firstname as &#8216;First Name&#8217;</p>
<p>,Case When birthdate is Null then &#8216;Not Entered&#8217; Else   <br />CASE len(CONVERT(varchar(2), datepart(mm, birthdate)))    <br />WHEN 1 THEN &#8217;0&#8242; + CONVERT(varchar(1), datepart(mm, birthdate))    <br />ELSE CONVERT(varchar(2), datepart(mm, birthdate))    <br />END    <br />+ &#8216;/&#8217; +    <br />CASE len(CONVERT(varchar(2), datepart(dd, birthdate)))    <br />WHEN 1 THEN &#8217;0&#8242; + CONVERT(varchar(1), datepart(dd, birthdate))    <br />ELSE CONVERT(varchar(2), datepart(dd, birthdate))    <br />END </p>
<p>END AS Birthday</p>
<p>FROM OHEM   <br />Order by birthday, lastname, firstname</p>
<p>/*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;*/</p>
<p>If you wanted to <strong>access the <em>Employee Master</em></strong> from this query you could add:</p>
<p><em>empid,</em></p>
<p>after the <em>Select</em></p>
<p>and </p>
<p><em>FOR BROWSE</em></p>
<p>on the line following the <em>Order By</em></p>
<p>If you would like to <strong>make this query into an alert</strong>, you could do all of the above <u>and</u> add the line </p>
<p><em>WHERE birthdate is not null</em></p>
<p>between the <em>FROM OHEM</em> and the <em>Order By</em>.</p>
<p>That would look like:</p>
<p>/* Displays a list of all the employees in SBO with their birthdays */   <br />/*(without the year) */</p>
<p>SELECT   <br />empid as &#8216;ID&#8217;    <br />,lastname as &#8216;Last Name&#8217;    <br />,firstname as &#8216;First Name&#8217;</p>
<p>,Case When birthdate is Null then &#8216;Not Entered&#8217; Else   <br />CASE len(CONVERT(varchar(2), datepart(mm, birthdate)))    <br />WHEN 1 THEN &#8217;0&#8242; + CONVERT(varchar(1), datepart(mm, birthdate))    <br />ELSE CONVERT(varchar(2), datepart(mm, birthdate))    <br />END    <br />+ &#8216;/&#8217; +    <br />CASE len(CONVERT(varchar(2), datepart(dd, birthdate)))    <br />WHEN 1 THEN &#8217;0&#8242; + CONVERT(varchar(1), datepart(dd, birthdate))    <br />ELSE CONVERT(varchar(2), datepart(dd, birthdate))    <br />END    <br />END AS Birthday</p>
<p>FROM OHEM   <br />WHERE birthdate is not null    <br />Order by birthday, lastname, firstname    <br />FOR BROWSE</p>
<p>&#160;</p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
<p style='text-align:left'>&copy; 2009, <a href='http://www.90minds.com'>Mark Chinsky</a>. 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.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-birthday-list-without-the-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

